s_puria
s_puria

Reputation: 407

URLs Get redirected to root for webroot files

I have a CakePHP app that has some html static files in webroot. HTML files are in some directories like webroot/dir1/dir2/page.html. When I enter url: site.com/dir1 I get redirected to site.com/webroot/dir1/ but when I enter site.com/dir1/ I get redirected to the first page site.com And If I enter url for the html file: site.com/dir1/dir2/page.html I get redirected to the first page site.com. It supposed to show the html file. How can I make it show html file and not redirect to first page?

In my public_html the htaccess is:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>

In the webroot the htaccess is:

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

Upvotes: 0

Views: 191

Answers (2)

jnemecz
jnemecz

Reputation: 3608

It's definitely not connected to CakePHP. Just ignore your directory / ies that should not be processed by CakePHP's routing system, see this related SO post.

Insert .htaccess into your directory/ies that should be ignored:

RewriteEngine Off

Upvotes: 1

set-wrong
set-wrong

Reputation: 11

your questions isn't about php, it's about the apache Webserver or more about -> Apache Module mod_rewrite

Rewrite Engine is only called one time, so you have to put all changes in one File.

kind regards set

Upvotes: 0

Related Questions