homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Global mod_rewrite
using mod_rewrite to pass all urls into one script.

WebmasterWorld Senior Member 10+ Year Member

Msg#: 158 posted 12:09 pm on Apr 7, 2003 (gmt 0)

I lay out all my websites with a file less directory structure, like this:

My scripting language wirks similar to php.
scripts are .htag and interpreter is htag/htag.exe

basically, I want to redirect all urls to

So far I've used this rule:
RewriteRule ^/(index\.htag/)?([^.]+)$ /index.htag/$2 [L]

by matching only strigns without dots I can still use standard filename references and it doesn't recurse.

My problem is that now I wanted to allow dots as well. So I need a check that prevents infiniet recursion once the index.htag is inserted.

I hope a
RewriteCond %{REQUEST_URI} !^/index\.htag.*
RewriteRule ^(/.+)$ /index.htag$1 [L]
would do it, only rewriting addresses that don't include the index.htag.

But in teh rewrite log (still causeing infinite recursion)
I get the following key items:
[rid#2ce2220/initial] (2) rewrite /wwscentral/xxx.html -> /index.htag/wwscentral/xxx.html
Which is waht I want,
[rid#2ce3470/initial/redir#1] (4) RewriteCond: input='/htag/htag.exe/wwscentral/xxx.html' pattern='!^/index\.htag.*' => matched

[rid#2ce3470/initial/redir#1] (2) rewrite /htag/htag.exe/wwscentral/xxx.html -> /index.htag/htag/htag.exe/wwscentral/xxx.html

Which keeps bringing the address around like this:

[rid#2ce4248/initial/redir#2] (2) init rewrite engine with requested uri /htag/htag.exe/htag/htag.exe/wwscentral/xxx.html

and never stops.

What am I missing? how can I prevent the script lookups to rewrite too?





10+ Year Member

Msg#: 158 posted 5:03 am on Apr 9, 2003 (gmt 0)

I wanted the same thing.

Here are sugestions that people gave me.


Also note, you can set apache's documentroot to be a script instead of a directory!

so if you use
ServerName my.domain.com
DocumentRoot "/some/directory/myspecialprogram.htag"

Then any requests such as my.domain.com/blah

will be handeled by that program.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved