Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
  • Register
Welcome to the Q&A for Question2Answer.

If you have questions about the platform, click here to ask and please use English.

If you just want to try Q2A, please use the demo, which also grants admin access.

Apr 29: Q2A 1.5.2

How to redirect www.domain.com to domain.com like perezhilton.com?

0 votes

my q2a site is already set to domain.com

returning visitor who type www.domain.com on browser can't use facebook login, because during regitration on fb ap its set to http://domain.com without www.

If you go to www.perezhilton.com you will notice it direct to perezhilton.com
i want to do the same thing. 

this is my current htaccess

 

DirectoryIndex index.php
RewriteEngine On
#RewriteBase /your-sub-directory
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]

I tried changing with htaccess below, mainpage working, but url post not working with 404 error.

 

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]


anybody know, how to do this?

thanks

asked Apr 2, 2011 in Q2A Core by anonymous
edited Apr 2, 2011

1 Answer

+1 vote
Did you delete the first set of lines? I think it should be:

DirectoryIndex index.php
RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]

RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
answered Apr 14, 2011 by DisgruntledGoat