All .htacces and mod_rewrite answered - examples, tips and tricks Forum Index  

All .htacces and mod_rewrite answered - examples, tips and tricks Forum Index -> URLs - other tricks -> Search pages in more than one directory
Author Message
admin
Site Admin


Joined: 18 Jul 2006
Posts: 89

PostPosted: Tue Jul 18, 2006 8:14 am    

Search pages in more than one directory

Reply with quote

Sometimes it is neccessary to let the webserver search for pages in more than one directory. Here MultiViews or other techniques cannot help. We program a explicit ruleset which searches for the files in the directories. RewriteEngine on

Code:
#   first try to find it in custom/...
#   ...and if found stop and be happy:
RewriteCond         /your/docroot/dir1/%{REQUEST_FILENAME}  -f
RewriteRule  ^(.+)  /your/docroot/dir1/$1  [L]

#   second try to find it in pub/...
#   ...and if found stop and be happy:
RewriteCond         /your/docroot/dir2/%{REQUEST_FILENAME}  -f
RewriteRule  ^(.+)  /your/docroot/dir2/$1  [L]

#   else go on for other Alias or ScriptAlias directives,
#   etc.
RewriteRule   ^(.+)  -  [PT]

Source:http://httpd.apache.org/docs/1.3/misc/rewriteguide.html
Back to top
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.   
View previous topic
View next topic
All .htacces and mod_rewrite answered - examples, tips and tricks Forum Index
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
FreeMind 1.1 Template by AU Templates