Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Global mod_rewrite

using mod_rewrite to pass all urls into one script.

12:09 pm on Apr 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

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?



5:03 am on Apr 9, 2003 (gmt 0)

10+ Year Member

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.


Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month