Vinas
Vinas

Reputation: 159

Rewriterule on .htaccess leads to 404

I am developing an application that's hosted on an apache server with PHP 5.

There is a website already running on the domain: www.domain.com. My application is on a folder called 'hotsite', and it can be accessed by the url www.domain.com/hotsite/.

The root folder contains a .htaccess containing:

/.htaccess:

XBitHack      Off
RewriteEngine On
RewriteCond   %{REQUEST_URI} \/([0-9a-z]{6})$ [NC]
RewriteRule   ^(.*) http://www.domain.com/url/forward.php?%1 [L]
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.domain.com
AuthUserFile /home/intera/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/intera/public_html/_vti_pvt/service.grp
RedirectMatch permanent ^/webmail$ http://http://mail.google.com/hosted/domain.com www.domain.com/hotsite/

In this 'hotsite' folder, there's a .htaccess file containing the following code:

/hotsite/.htaccess:

RewriteEngine on
RewriteBase /
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ /folder/index.php

Now, when I access www.domain.com/hotsite/, my application loads fine. but when I try and access www.domain.com/hotsite/section/, it appears to ignore the .htaccess file and tries to access "section" as if it was a folder, returning a 404 error.

Any ideias why this is happening and what should I do to make it work?

Thanks =)

Upvotes: 1

Views: 258

Answers (1)

Gerben
Gerben

Reputation: 16825

If the htaccess is inside the hotsite folder, then RewriteBase / needs to be RewriteBase /hotsite

Just in case; Note that the rewriterule, rewrites to /folder/index.php, and not /hotsite/folder/index.php

Upvotes: 1

Related Questions