I have a Magento installation in base directory and WordPress installation in my sub directory. When I open the home page of WordPress it opens normally but when I go to any sub-page/post of WordPress it gives 404 not found error from Magento. I've tried almost everything on the .htaccess file but didn't find the solution. I also tried the solution from Magento under WordPress as subdirectory not working but that doesn't work for me.

This is my .htaccess file:

DirectoryIndex index.php
<IfModule mod_php5.c>
    php_value memory_limit 256M
    php_value max_execution_time 18000
    php_flag magic_quotes_gpc off
    php_flag session.auto_start off
    php_flag suhosin.session.cryptua off
    php_flag zend.ze1_compatibility_mode Off
<IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off
<IfModule mod_ssl.c>
    SSLOptions StdEnvVars
<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^api/rest api.php?type=rest [QSA,L]
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]
    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule .* index.php [L]
AddDefaultCharset Off
<IfModule mod_expires.c>
    ExpiresDefault "access plus 1 year"
Order allow,deny
Allow from all
    order allow,deny
    deny from all
<Files cron.php>
    Order allow,deny
    Deny from all

and .htaccess for WordPress:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /blog/*
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]

1 Answer 1


I suspect this is down to your rewrite base having the * at the end, as per How to add another web app to a subdirectory within Magento? (although that's quite old)

I suspect that you are using Apache, and if this is not a duplicate of that question, it would be better to ask this of Apache experts rather than Magento experts.

(Sorry, can't comment yet, so had to answer...)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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