Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Htaccess problem (quickie)

2 views
Skip to first unread message

frizzle

unread,
May 27, 2006, 2:10:47 PM5/27/06
to
Hi group,

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.

Robert Ionescu

unread,
May 27, 2006, 3:16:08 PM5/27/06
to
frizzle wrote:
> Those folders actually exsist,
[...]

> Now when i try to access domain.com/testfolder/img
> in Firefox & IE i get redirected to domain.com/testfolder/img/?img

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

frizzle

unread,
May 27, 2006, 6:25:22 PM5/27/06
to

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?)

frizzle

unread,
May 28, 2006, 2:49:33 PM5/28/06
to

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.

frizzle

unread,
Jun 1, 2006, 5:51:58 AM6/1/06
to

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]

frizzle

unread,
Jun 3, 2006, 12:12:43 PM6/3/06
to

Anyone ?

0 new messages