You are here:  » SEO Rewrite Sub Directory Challenge


SEO Rewrite Sub Directory Challenge

Submitted by DubaiCrazy on Tue, 2016-10-25 12:00 in

I have enabled SEO Rewrite and when I set the site up on the main domain it works, however, when I move the entire site to a sub directory I get the following error:

Gone

The requested resource
/sub/category/TV/
is no longer available on this server and there is no forwarding address. Please remove all references to this resource.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Is there anything i need to amend within the htaccess file as I assume that is where the error is? My code is below:

Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^product/(.*).html$ products.php?q=$1&rewrite=1&%{QUERY_STRING} [B,L]
RewriteRule ^review/(.*).html$ reviews.php?q=$1&rewrite=1&%{QUERY_STRING} [B,L]
RewriteRule ^merchant/$ merchants.php
RewriteRule ^merchant/(.*)/$ search.php?q=merchant:$1:&rewrite=1&%{QUERY_STRING} [B,L]
RewriteRule ^merchant/(.*)/(.*).html$ search.php?q=merchant:$1:&page=$2&rewrite=1&%{QUERY_STRING} [B,L]
RewriteRule ^category/$ categories.php [L]
RewriteRule ^category/(.*)/$ categories.php?path=$1 [L,B]
RewriteRule ^category/(.*)/(.*).html$ search.php?q=category:$1:&page=$2&rewrite=1&%{QUERY_STRING} [L,B]
RewriteRule ^brand/$ brands.php
RewriteRule ^brand/(.*)/$ search.php?q=brand:$1:&rewrite=1&%{QUERY_STRING} [B,L]
RewriteRule ^brand/(.*)/(.*).html$ search.php?q=brand:$1:&page=$2&rewrite=1&%{QUERY_STRING} [B,L]

Any help greatly appreciated.

Thanks, Chris

Submitted by support on Tue, 2016-10-25 12:09

Hi Chris,

You need to update RewriteBase at line 3 to include the installation directory:

RewriteBase /sub/

That should be all it is...

Cheers,
David.
--
PriceTapestry.com

Submitted by DubaiCrazy on Tue, 2016-10-25 12:17

Strange... I made the change but the error still persists.

Submitted by support on Tue, 2016-10-25 13:03

Hi Chris,

I wonder if there is a .htaccess file in the top level that is conflicting - specifically, if there are any "catch all" rules, they would need to have RewriteCond statements in place to ensure that they don't prevent access to sub-directories. The usual method is to prefix any catch-all rules using:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

...which means that the following (only) RewriteRule will only apply if there is not a file or directory also matching the request...

Cheers,
David.
--
PriceTapestry.com