|
wordpress subdirectory trailing slash problem – FIXED[9.5.07]
(Warning: Computer geeky post.) I'm writing this here for my personal reference just in case I ever had to do this crap again. Situation: I wanted what's called a "forced www" on all parts of this web site. Some say www is deprecated. I think those people are full of crap (else why would Google do it?) So I added an .htaccess redirect in the public root of this domain. If I type "frostedside.com" in a browser, it auto-changes it to "www.frostedside.com" just like it's supposed to. My WordPress installation happens to reside in a subdirectory, blog. Even with the .htaccess redirect, WordPress insists on not adding the www to the web address. I scoured the internet looking for a solution to this, because no matter what I did, if I typed in "frostedside.com/blog", no www would show up. Bleah. I finally found a solution. Don't use an .htaccess file in the WordPress subdirectory at all. Put everything in your public root .htaccess instead. This is what I have now: # FORCE WWWRewriteEngine onRewriteCond %{HTTP_HOST} ^frostedside.com [NC]RewriteRule ^(.*)$ http://www.frostedside.com/$1 [L,R=301]
# WORDPRESSRewritebase /blogRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*) index.php [L]
...and it works. Whether I use a slash or not (such as frostedside.com/blog without the trailing slash,) the www now shows up like it's supposed to. Yay. :-)
|
Rich’s Latest Videos |
||
|
return to top
|
|||