ShaneJones
asked on
Rewriting with mod-rewrite
Need some help rewriting, with mod_rewrite, i cannot get the result i want even though I know it can be done and I just cannot understand the mod_rewrite stuff.
I am after something like the following
rewrite from www.domain.com/index.php?cPath=21
to www.domain.com/aprilia-parts/
and
rewrite from www.domain.com/index.php?cPath=22
to www.domain.com/ducati-parts/
can anyone help or maybe even post some example code to help.
Many thanks
I am after something like the following
rewrite from www.domain.com/index.php?cPath=21
to www.domain.com/aprilia-parts/
and
rewrite from www.domain.com/index.php?cPath=22
to www.domain.com/ducati-parts/
can anyone help or maybe even post some example code to help.
Many thanks
ASKER
Seems to return a http 500 error on the server.
Eh, lots of mistakes. Looks like it was too early in morning
Can You confirm those two typo by looking at error log?
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} ^cPath=21$
RewriteRule ^index.php$ /aprilia-parts/ [L]
RewriteCond %{QUERY_STRING} ^cPath=22$
RewriteRule ^index.php$ /ducati-parts/ [L]
Can You confirm those two typo by looking at error log?
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} ^cPath=21$
RewriteRule ^index.php$ /aprilia-parts/ [L]
RewriteCond %{QUERY_STRING} ^cPath=22$
RewriteRule ^index.php$ /ducati-parts/ [L]
ASKER
hmm now returns this (scratches head)
Not Found
The requested URL /aprilia-parts/ was not found on this server.
Not Found
The requested URL /aprilia-parts/ was not found on this server.
Well, do it exists? When You enter into browser the url manually, does it work? http://www.yourdomain.tld/aprilia-parts/
ASKER
typing it into the browser does not work
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
into the .htaccess
Option +FollowSymLinks
RewriteEngin On
RewriteCond %{QUERY_STRING} ^cPath=21$
RewriteRule ^index.php$ /aprilia-parts/ [L]
RewriteCond %{QUERY_STRING} ^cPath=22$
RewriteRule ^index.php$ /ducati-parts/ [L]
If You want the browser change it's URL, use [L,R=301] instead of single [L]