|
Home > Archive > Apache Server configuration support > September 2007 > mod_rewrite problem
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
mod_rewrite problem
|
|
| seth7f@gmail.com 2007-09-04, 1:21 am |
| I would like to rewrite this:
http://www.domain.name/first/second/third?name=value
To this:
http://www.domain.name/index.php/fi...hird?name=value
I am inserting "index.php/" after the domain name.
But I don't want to rewrite the URLs for
a) Files with extension css|gif|jpg|js + others
b) URLs starting with "http://www.domain.name/fourms/"
c) URLs starting with "http://www.domain.name/wiki/"
I am then using php to grab data form the URL ($first=first,
$second=second)
Mod_Rewrite is new to me. From reading the Apache manual I can see it
can be done but
just can't work it out!
Here's what I' trying:
RewriteEngine on
RewriteCond %{REQUEST_URI] !^/forms
RewriteCond %{REQUEST_URI] !^/wiki
RewriteCond %{REQUEST_URI] !\.(gif|jpg|css|js|php|pdf|xml|txt)$
RewriteRule ^(.*)$ index/%1
And the error from the log:
Request exceeded the limit of 10 internal redirects due to probable
configuration error. Use 'LimitInternalRecursion' to increase the
limit if
necessary. Use 'LogLevel debug' to get a backtrace
Thanks for any help
Seth
| |
| Jim Hayter 2007-09-04, 1:23 pm |
| seth7f@gmail.com wrote:
> I would like to rewrite this:
>
> http://www.domain.name/first/second/third?name=value
>
> To this:
>
> http://www.domain.name/index.php/fi...hird?name=value
>
> I am inserting "index.php/" after the domain name.
>
> But I don't want to rewrite the URLs for
>
> a) Files with extension css|gif|jpg|js + others
> b) URLs starting with "http://www.domain.name/fourms/"
> c) URLs starting with "http://www.domain.name/wiki/"
>
> I am then using php to grab data form the URL ($first=first,
> $second=second)
>
> Mod_Rewrite is new to me. From reading the Apache manual I can see it
> can be done but
> just can't work it out!
>
> Here's what I' trying:
>
> RewriteEngine on
> RewriteCond %{REQUEST_URI] !^/forms
> RewriteCond %{REQUEST_URI] !^/wiki
> RewriteCond %{REQUEST_URI] !\.(gif|jpg|css|js|php|pdf|xml|txt)$
> RewriteRule ^(.*)$ index/%1
>
> And the error from the log:
>
> Request exceeded the limit of 10 internal redirects due to probable
> configuration error. Use 'LimitInternalRecursion' to increase the
> limit if
> necessary. Use 'LogLevel debug' to get a backtrace
>
> Thanks for any help
>
You also need to exempt URLs that already have "index" in place. That
is where you are looping.
Jim
| |
| sean dreilinger 2007-09-13, 1:21 am |
| seth7f@gmail.com wrote:
> I would like to rewrite this:
> http://www.domain.name/first/second/third?name=value
> To this:
> http://www.domain.name/index.php/fi...hird?name=value
....
>
> RewriteEngine on
> RewriteCond %{REQUEST_URI] !^/forms
> RewriteCond %{REQUEST_URI] !^/wiki
> RewriteCond %{REQUEST_URI] !\.(gif|jpg|css|js|php|pdf|xml|txt)$
> RewriteRule ^(.*)$ index/%1
try
1. adding a condition to exclude urls that already start with /index (per jim
hayter)
2. did you mean to exclude /forms or /forums, or both?
3. changing %1 to $1 in your substitution string.
4. use qsappend in the RewriteRule to retain any query string
it could look like this, untested:
RewriteEngine on
RewriteCond %{REQUEST_URI] !^/(foru?ms|wiki|index)
RewriteCond %{REQUEST_URI] !\.(gif|jpg|css|js|php|pdf|xml|txt)$
RewriteRule ^/(.*) /index/$1 [last,qsappend]
hth
-sean
--
sean dreilinger - http://durak.org/sean/
|
|
|
|
|