How can i finetune this?

Discuss practical ways rearrange URLs using mod_rewrite.

How can i finetune this?

Postby kesobatong » Mon Dec 20, 2004 1:27 pm

this is what i have:

RewriteCond %{REQUEST_URI} !^/images/.*$
RewriteCond %{REQUEST_URI} !^/styles.css
RewriteCond %{REQUEST_URI} !^/favicon.ico
RewriteRule ^/(.*)$ /index.php?$1


and i need to add a condition for every file/dir i want to exclude.
Why doesnt it work with just this?

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ /index.php?$1

Some other guy said alias would do the trick faster. Couldnt be that much faster? it would only skipp the regex i think. Anyone having any thoughts?

Thanks!
kesobatong
 
Posts: 1
Joined: Mon Dec 20, 2004 1:23 pm

Postby Caterham » Thu Jan 06, 2005 1:05 pm

Try
Code: Select all
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.* - [L]

RewriteRule ^/(.*)$ /index.php?$1 [L]
Why doesnt it work with just this?
I don't know.

Some other guy said alias would do the trick faster. Couldnt be that much faster? it would only skipp the regex i think. Anyone having any thoughts?
I don't know, what you'd like to achieve. Do you have some prefix
/prefix/index.php?

An alias might be useful, if you have files OUTSIDE the usual htdocs folder. You can map other physicaly folders from your harddrive outside the htdocs with an alias, eg:

http://example.com/folder
would call /www/htdocs/folder

but you can have an alias on 'folder' that
/var/usr/files would be called

Bob
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 42 guests

cron