0

Hi All,

I currently have an .htaccess set up to rewrite to a single URL.

at the minute it is for places. so mysite.com/region/town will rewrite to places.php

i now need to add another, this time for skill i.e. mysite.com/construction/bricklayer and i want it to redirect to skills.php

i have included the re-write below. Any help would be appreciated.

# category two or more levels down

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/$ places.php?place=$3&rr=9 [nc,L,qsa]

# category one level down

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9_-]+)/$ places.php?place=$1&rr=13 [nc,L,qsa]
2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by pritaeas
0

How will you determine whether a link is region/town or construction/bricklayer ? Both rewrites are two levels, and are built using identical expressions. My guess is that you can only solve this by using a PHP file to determine which one it is and do the correct redirect.

Edited by pritaeas: n/a

0

thats the magic question. I have no idea. At present this works for places only.

0

If you want to use a PHP file, then you need some way to determine which of the two it is (database perhaps).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.