Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
834 views
in Q2A Core by

I tried the next code in .htaccess but only work in homepage, if i go for example to  www.site.com/questions it dont redirect:

<IfModule mod_rewrite.c> 
RewriteEngine On 
#RewriteBase / 
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]

--------

RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
----------
Dont work for me, i need help.
Q2A version: Q2A 1.6.2

1 Answer

–1 vote
by
edited by

I have already posted solution before... please search before posting :-)


Also make sure you are not adding www in admin->general->Preferred site URL

 

For www to non-www



DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
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]

# Redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

</IfModule>


 

 

by
perfect.....
...