Forum Moderators: phranque

Message Too Old, No Replies

RewriteBase Problem

RewriteBase Problem

         

bluecomp

10:23 am on Aug 28, 2008 (gmt 0)

10+ Year Member



Hi Every One,

I need urgent help on a very small issue. Below is my .htaccess file which works properly on the root folder but not on the subfolder of a domain

*********************************
RewriteEngine on
RewriteBase /
AddType application/x-httpd-php .htm .html

php_flag magic_quotes_gpc off
php_flag register_globals on
php_flag upload_max_filesize 100M

RewriteRule ^(index\.html¦contact\.html¦portfolio\.html) - [L]
RewriteRule ^([^/]+)\.html$ /page.php?main_code=$1 [L]
RewriteRule ^([^/]+)/([^/]+)\.html$ /page.php?main_code=$1&left_menu_code=$2 [L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)\.html$ /page.php?main_code=$1&left_menu_code=$2&left_sub_code=$3 [L]

ErrorDocument 404 /404.php
*********************************************

All files including the .htaccess are in the folder named "2008"

Thanks in Advance

vincevincevince

12:41 pm on Aug 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As in your title..
RewriteBase /
..is the problem.

Tried

RewriteBase /2008

?

Be sure to remove the .htaccess from the root folder when you try it in the sub folder, or it will override the sub folder's one through rule 3 and 4.

You could write a condition to exclude 2008 from the root's .htaccess

jdMorgan

4:18 pm on Aug 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



RewriteBase is not intended for this purpose anyway. It is intended for use when DocumentRoot points to a directory other than the true HTTP Web root of the site. See Apache docs for details.

If this .htaccess file is located in "/2008" and "page.php" is also located in "/2008," then the substitution URLs (actually filepaths) on the right side of the rule must include "2008" -- Without it, "page.php" will be expected to reside in the Web root directory.

As in many cases, examining your server error log will likely be quite helpful in sorting this out.

Jim