Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a non-Wordpress site , www.example.com

For canonicalization purposes I have this in .htaccess :

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]   

This way all non-www links will be redirected to www version of site.

Recently I decided to attach a wordpress blog at www.example.com/blog . After the installation is complete, whenever I go to www.example.com/blog I get 404 - Page not found error. I tried both auto install with Fantastico and a manual install, with the same result.

I found out that when I remove the piece of code above from my .htaccess it fixes the problem, and wordpress installation is accessable and usable.

However, I would like to keep the the original htaccess settings, for SEO purposes. I tried to change url version in wordpress General Settings and then restore main site htaccess file - it would still break the wordpress and 404 is back again.

I tried to add next code in wp-config.php :

define('WP_HOME','http://www.example.com/blog');
define('WP_SITEURL','http://www.example.com/blog');

It didn't fixed the problem either...

I understand it has something to do with htaccess. I also notices that there is no htaccess file in wordpress folder, probably due to the fact that I haven't changed permalinks settings yet.

I would appreciate any help on this matter!

P.S: I just noticed that www.example.com/blog/wp-login.php is visible regardless of htaccess config, however after I log in it brings me to 404 page again :(

share|improve this question
    
home and site url should be http://www.example.com/blog if it's installed in a folder named blog. –  Milo Aug 7 '11 at 16:14
    
yeah it is blog, sorry I submited the code from the example webpage, let me update original post –  Alex Aug 7 '11 at 16:16
1  
what is the url it sends you to when you log in? make sure you clear your cache after any change, your browser will cache a 404 page. I tried your .htaccess rules on my own server and wp in a directory and it all works fine, not sure what your issue is. –  Milo Aug 7 '11 at 16:33
    
When I log in it sends me to www.example.com/blog/wp-admin/ ... I also been clearing cache every step of the way .. I know this wierd and htaccess rules work fine for non-wordpress part of site, it just for some reason the wordpress is having issues with it :( –  Alex Aug 7 '11 at 16:46
    
Try going to example.com/blog/wp-admin/options-permalink.php. That should work, because the php file actually exists. If so, try updating your permalink options to a friendly version, like "Day and name". This will put a new .htaccess in the blog directory -- I'm thinking that that new .htaccess will override the one in the parent directory. –  Chris Carson Aug 7 '11 at 17:05
show 3 more comments

2 Answers

up vote 1 down vote accepted

As per @Milo, I'm adding my comment above as an answer...

Try going to example.com/blog/wp-admin/options-permalink.php. That should work, because the php file actually exists. If so, try updating your permalink options to a friendly version, like "Day and name". This will put a new .htaccess in the blog directory -- I'm thinking that that new .htaccess will override the one in the parent directory.

share|improve this answer
add comment

You don't need that code. WordPress itself handles redirects to canonical URLs. Just set it up to have the www address in Settings->General and it will redirect the traffic without your htaccess rules.

share|improve this answer
    
I know about this wordpress ability, but My main site is non-Wordpress, wordpress is just a little blog in a blog folder... –  Alex Aug 7 '11 at 16:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.