Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
845 views
in Q2A Core by
I have added below rules in htaccess file to redirect www to non-www.

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

But when I access like www.mysite.com/1/question-title it is redirecting to mysite.com/index.php?qa-rewrite=1/question-title and throws a 404 error.
In other words I want to redirect all www pages to non-www and I am stuck.

Please help :)
Q2A version: 1.7.0

1 Answer

0 votes
by
Try adding the redirect rules after </IfModule>. It worked for me.
by
It's not working. I tried the below code

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.(.)$ [NC]
RewriteRule ^(.)$ http://%1/$1 [R=301,L]
</IfModule>

Need help!
...