I've been a member here before but have had to re-join as forgotten my username!
Anyway I've been pulling my hair out trying to get some sef rewrites to work in htaccess using regex. I've been all over the place trying to find some code that will work but all I've found is stuff that's well old or stuff that doesn't work correctly. This is the scenario. I'm developing a site and this is what I want to rewrite:
http://www.thesite.com/location/product.php?id=prodtype to this http://www.thesite.com/location/prodtype
The latest thing I've tried is this:
AddType x-mapp-php5 .php
RewriteEngine on
RewriteRule ^/([a-z])/([a-z])$ /$1.php?id=$2
But it just keeps coming up with page not found. Any help much appreciated or if anyone can point me to somehwere where there is a tutorial on sef rewriting with php that works that would be great. Please bare in mind I am using shared hosting so limited to doing this via htaccess.
Cheers
SEF re-writes
Moderator: General Moderators
-
lettie1641
- Forum Newbie
- Posts: 2
- Joined: Thu Sep 29, 2011 9:38 am
Re: SEF re-writes
Worked this out myself now! With a little help from this thread and socalocmatt's answer. Cheers guys. Re-wrtie rule I used below:
viewtopic.php?f=1&t=108901&p=577390&hil ... es#p577390
RewriteRule ^([^/]*)/([a-zA-Z0-9_-]+)$ /$1/yourpage.php?loc=$1&cat=$2 [L]
This will rewrite something like [text]http://www.yoursite.com/folder/category[/text]
to
[text]http://www.yoursite.com/folder/yourpage ... t=category[/text]
Hope this helps someone.
viewtopic.php?f=1&t=108901&p=577390&hil ... es#p577390
RewriteRule ^([^/]*)/([a-zA-Z0-9_-]+)$ /$1/yourpage.php?loc=$1&cat=$2 [L]
This will rewrite something like [text]http://www.yoursite.com/folder/category[/text]
to
[text]http://www.yoursite.com/folder/yourpage ... t=category[/text]
Hope this helps someone.