How to write regex that all request from browser contain such as
[rentacar.com...]
[rentacar.com...]
that all those request serve by cars.php
Im tryng to create .htaccess like this but seems doesnt works :
RewriteEngine on
RewriteRule ^/\(cars-*)/\*$ /cars.php?uri=%{REQUEST_URI}
I got internal server error on apache. error logs is :
[Mon Jul 15 19:19:02 2002] [alert] [client 127.0.0.1] c:/inetpub/wwwroot/i/.htaccess: RewriteRule: cannot compile regular expression '^/\(cars*)/\*$'
Apache server shutdown initiated...
Any idea?
It wasn't clear exactly how you wanted to pass the page number to php, but here
are a couple of examples:
This rule
RewriteEngine on
RewriteRule ^cars-(.*)$ cars.php?uri=$1 [L]
will rewrite
[rentacar.com...]
to
[rentacar.com...]
This rule
RewriteEngine on
RewriteRule ^cars-(.*)/.*$ cars.php?uri=$1 [L]
will rewrite
[rentacar.com...]
to
[rentacar.com...]
This rule
RewriteEngine on
RewriteRule ^cars-(.*)/(.*)$ cars.php?toppage=$1&subpage=$2 [L]
will rewrite
[rentacar.com...]
to
[rentacar.com...]
Note that "." means "any character" and "*" means "any number of the preceding
character". Wildcards and escaped characters are not the same as in scripting
languages. Take a look at www.apache.org and look up the mod_rewrite module
of Apache Server. There is a lot of information there. Also, a search for
"regular expressions regex" on a top search engine will turn up many syntax and
usage guides for the regular expressions used by mod-rewrite.
Note: If none of the above rules work, try escaping the "-" in "cars-" by
putting a "\" in front of it. Warning - I didn't test these!
Hope this helps!
Jim
or
[xyz.com...] its mean
[xyz.com...]
because I will take the URL request point as parameter for the database
and through your example, I have change my script become:
RewriteEngine on
RewriteBase /
RewriteRule ^cars-(.*)$ /cars.php?uri=%{REQUEST_URI}
once again thank you