jeudi 15 mai 2014

non-www to www redirect not working for articles in subdirectory installation of WordPress


Vote count:

0




I am helping out with a website that has a main/root website as well as a WordPress installation in a sub-directory. The .htaccess file of the main site has rules to redirect non-www traffic to www:



RewriteCond %{HTTP_HOST} ^site\.com [NC]
RewriteRule (.*) http://ift.tt/1ljVkOk [R=301,L]


However, this has no effect on the WP site. For instance:



  • site.com would redirect to www.site.com

  • http://ift.tt/1qFUpP3 would redirect to http://ift.tt/1ljVkOm...

  • site.com/wordpress does not redirect to http://ift.tt/1ljViWy


I added similar rules to the WordPress .htaccess, playing around to try to get the result I would expect, but the best I could come up with is this:



RewriteCond %{HTTP_HOST} ^site\.com [NC]
RewriteRule (.*) http://ift.tt/1qFUpP7 [R=301,L]


...which successfully redirects site.com/wordpress to http://ift.tt/1ljViWy, but does not redirect http://ift.tt/1ljVl4F.


I feel like I must be missing something simple or obvious, but hours of experimentation and research have not yielded a thing except that .htaccess files in sub-directories are not advised (but I think this is unavoidable in this case).


I would be grateful for any suggestions on how to fix the rewrite condition or rule to successfully redirect the post links of the WP site.


Thanks!



asked 18 secs ago






Aucun commentaire:

Enregistrer un commentaire