Forum Moderators: phranque
Here is the issue: i have a few rewriteRule set via .htaccess. It works fine except with one specific ajax call that i do.
Here is the url of the ajax call:
http://localhost/domain.com/dev/medias/03-05-2008_bright-archite/ And here is the Rewrite rule directive:
RewriteRule ^medias/([a-z0-9-]+)/$ index.php?section=news&sortBy=medias&item=$1&dsAnchor=&%{QUERY_STRING} [NC,L] What should happen is the request should be redirected to my index.php page, yet it does not and displays the directory listing as a result of the ajax call.
Can someone explain why the redirection does not occur?
In case it helps, here is the entire htaccess file content:
Anybody can help? Please i'm really stuck.
In case it helps, here is the full htaccess:
RewriteEngine on
#--------------------------------------------
# PRETTY URLS
#--------------------------------------------
# Externally redirect to add missing trailing slash
RewriteRule ^(([a-z0-9-]+/)*[a-z0-9-]+)$ http://localhost/domain.com/dev/$1/?%{QUERY_STRING} [NC,R,L]
# SEVEN PARAMS
RewriteRule ^([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/$ index.php?section=$1&sortBy=time&dsAnchor=2007&item=$2&menu=$3&content=$4&id=$5&title=$6&js=$7&%{QUERY_STRING} [NC,L]# SIX PARAMS
RewriteRule ^([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/$ index.php?section=$1&sortBy=time&dsAnchor=2007&item=$2&menu=$3&content=$4&id=$5&title=$6&%{QUERY_STRING} [NC,L]
# FIVE PARAMS
RewriteRule ^([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/$ index.php?section=$1&sortBy=time&dsAnchor=2007&item=$2&menu=$3&content=$4&id=$5&%{QUERY_STRING} [NC,L]
# FOUR PARAMS
RewriteRule ^([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/([a-z0-9-_]+)/$ index.php?section=$1&sortBy=time&dsAnchor=2007&item=$2&menu=$3&content=$4&%{QUERY_STRING} [NC,L]
#
# THREE PARAMS : projects/touch/texts/
RewriteRule ^([a-z0-9-]+)/([a-z0-9-]+)/([a-z0-9-]+)/$ index.php?section=$1&sortBy=time&item=$2&menu=$3&%{QUERY_STRING} [NC,L]
#
# TWO PARAMS : PROJECTS
RewriteRule ^projects/([a-z0-9-]+)/$ index.php?section=projects&item=$1&dsAnchor=&%{QUERY_STRING} [NC,L]
# TWO PARAMS : medias
RewriteRule ^medias/([a-z0-9-]+)/$ index.php?section=news&sortBy=medias&item=$1&dsAnchor=&%{QUERY_STRING} [NC,L]
# TWO PARAMS : NEWS
RewriteRule ^news/([a-z0-9-]+)/$ index.php?section=news&item=$1&dsAnchor=&%{QUERY_STRING} [NC,L]
# TWO PARAMS : people
RewriteRule ^people/([a-z0-9-]+)/$ index.php?section=people&item=$1&dsAnchor=&%{QUERY_STRING} [NC,L]
# ONE PARAM
RewriteRule ^([a-z0-9-]+)/$ index.php?section=$1&%{QUERY_STRING} [NC,L]
# TAG URL : index.php?tag=space%2C+navigable+music#5
RewriteRule ^tag/([a-z0-9-]+)/$ index.php?tag=$1&%{QUERY_STRING} [NC,L]
Alexandre
What it is now is:
RewriteRule ^medias/([a-z0-9-_]+)/$ index.php?section=news&sortBy=medias&item=$1&dsAnchor=&%{QUERY_STRING} [NC,L]
thank you so much ! With the energy brought by the relief of finding the cause to the problem i'm heading over the php forum to see if i can be of help to others.
We had a very recent thread on just this problem -- within the past ten days or so.
Use "[0-9\-]" to prevent this from happening on any server, present or future. Escaping the hyphen prevents any ambiguity in whether a literal hyphen or a regular-expressions character-range operator is intended.
Jim