Code Lover
Code Lover

Reputation: 8378

Rewrite rule for website in Sub-Directory

I am having WordPress website and having sub-directory installed another site in it. Having URL 404 issue for all sub pages for child website ( installed in sub-directory)

It is loading the landing page for child website but as soon as try to access any page or post it is giving 404 error. This CMS have own .htaccess.

Path:
Wordpress: wp/.htaccess
QA:        wp/qa/.htaccess

Wordpress .htaccess code

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

# END WordPress

QA .htaccess code

DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>

I don't know much about rewrite rule so please help me to sort this out. Million thanks

Upvotes: 0

Views: 309

Answers (1)

John Smith
John Smith

Reputation: 186

Try to change QA .htaccess to this:

DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /qa/
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /qa/index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>

Upvotes: 2

Related Questions