I have the htaccess code that is below to redirect everything to
index.php exept for the mentioned folders. (img, swf, js and css)
Those folders actually exsist, others are faked.
Now when i try to access domain.com/testfolder/img
in Firefox & IE i get redirected to domain.com/testfolder/img/?img
If i access the same address *with* a trailing slash, it's ok.
How can i fix this?
And i was wondering if i could 'tell' the htaccess to use the folder
it's in as root automatically.
# S T A R T H T A C C E S S # # # # # # # # # # # # # # # #
RewriteEngine On
RewriteBase /testfolder/
RewriteRule ^(index\.php)$ - [PT]
RewriteRule ^(img|swf|js|css)/.*$ - [PT]
RewriteRule ^(.*)$ index.php?$1 [L]
# E N D H T A C C E S S # # # # # # # # # # # # # # # # # #
Frizzle.
This is caused by interaction with mod_dir running after mod_rewrite. So
make sure img will match, too:
RewriteEngine On
RewriteBase /testfolder/
# use the L-Flag in .htaccess files, PT is for httpd.conf/per-server
# context
RewriteRule ^(img|swf|js|css|index\.php$) - [L]
RewriteRule ^(.*)$ index.php?$1 [L]
--
Robert
Thanks! I don't completely understand what you're telling me, but when
i read your solution, i believe it would also accept index.php being
called directly, wich isn't meant to be. I hope you understand what i
mean.
Greetings Frizzle.
(ow yeah, is it possible to have the htaccess use it's own dir as root
automatically?)
I'm sorry, i tried your solution, but i still experience the same
problem:
it's still redirecting me if i try to access one of the 'excluded' dirs
without a trailing slash.
Frizzle.
I've searched, searched and tried! I still cannot figure it out ...
I _know_ the problem is in the trailing slash, but i cannot figure the
RewriteRule to redir if a folder (thus w/o extension) is called without
a trailing slash, to redir it to the same path with a traling slash.
Now if i request the root folder (testfolder) w/o a trailing slash it
redirs me to
http://domain.com/testfolder/?/usr/local/psa/home/vhosts/domain.com/httpdocs/testfolder
Any help would be great.
Frizzle.
I have the following code:
RewriteEngine On
RewriteBase /testfolder/
RewriteRule ^(index\.php)$ - [L]
RewriteRule ^((img|swf|js|css)(/.*)?)$ - [L]
RewriteRule ^(.*)$ index.php?$1 [L]
Anyone ?