This is a discussion on Wordpress .htaccess file for no-www and mod-rewrite() within the Blogs & Blogging forums, part of the Webmaster Discussion category; I currently have this as my .htaccess file for WP Code: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog/ ...
| |||||||
| Register | Forum Rules | FAQ | Donate | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Try this one HTML Code: RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.cormacmoylan\.com$ [NC]
RewriteRule .* http://www.cormacmoylan.com/ [L,R=301]
|
| |||||
| So is it working now?
__________________ Hosting & Domains|Plesk Vps Hosting|Blog Tips|Films.ie|Gadgets|Monetisation Tips|Movie Chat Energise your forum! Click here for info |
| |||||
| I think you need the no-www code in httpd.conf because once the server gets to your .htaccess it has already chosen what domain/subdomain to use. Httpd.conf lets Apache know ahead of time so it can redirect the domain request, not just at the folder/file level. AFAIK. |
| |||||
| Cormac, I have that setup on my blog now, and have no major issues. The .htaccess in my wordpress folder is now as follows: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^blog.moybella.net$ [NC] RewriteRule ^(.*)$ http://blog.moybella.net/$1 [L,R=301] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> In my vhost entry, blog.moybella.net is the ServerName and the ServerAlias is "www.blog.moybella.net blog.moybella.com www.blog.moybella.com" Niall. |
| |||||
| Is there are reason one would do this... just wondering? |
| |||||
| Use Of www Also, having more than one domain pointing at your site without a 301 redirect can dilute your pagerank as I understand it. Last edited by niall; 14-03-2007 at 04:01 PM. Reason: Spelling error |
| |||||
| |