XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).
Moderator: General Moderators
-
m2babaey
- Forum Contributor
- Posts: 364
- Joined: Sun May 20, 2007 9:26 am
Post
by m2babaey »
Hi
I use this rule:
Code: Select all
RewriteRule ^restaurants/([^/\.]+)/([^/\.]+)/([0-9]+)(.*)/ $ project/food/restaurentProfile.php?rid=$3
to redirect
domain.com/restaurants/state/city/12542-restaurant_name/
to
domain.com/restaurants.php?rid=12542
But I get 500 Internal Server Error
Where I am wrong?
Thank you for your help
Also tried this rule:
Code: Select all
RewriteRule ^restaurants/([^/\.]+)(.*)/([^/\.]+)(.*)/([0-9]+)(.*)/ $ restaurentProfile.php?rid=$5
-
mrvijayakumar
- Forum Commoner
- Posts: 58
- Joined: Tue Aug 18, 2009 12:39 am
- Location: Chennai city, India
-
Contact:
Post
by mrvijayakumar »
hi,
I hope problem is in /([^/\.]+)/([^/\.]+)/([0-9]+)(.*)/ $ this part. Try below code, It will works fine.
Code: Select all
RewriteRule ^restaurants/([^/]+)/ $ project/food/restaurentProfile.php?rid=$3
-
m2babaey
- Forum Contributor
- Posts: 364
- Joined: Sun May 20, 2007 9:26 am
Post
by m2babaey »
Thanks
I think space was a problem
This code is working now:
Code: Select all
RewriteRule ^restaurants/([^/.]+)/([^/.]+)/([0-9]+)(.*)$ project/food/restaurentProfile.php?rid=$3
Any security improvement suggestions?
This was my first rewrite rule
-
m2babaey
- Forum Contributor
- Posts: 364
- Joined: Sun May 20, 2007 9:26 am
Post
by m2babaey »
Also how can i make it work vice versa
I mean redirect
domain.com/restaurants/state/city/restaurant_name-12542
to domain.com/restaurants.php?rid=12542
I tried this code but sends me a not found error:
Code: Select all
RewriteRule ^restaurants/([^/.]+)/([^/.]+)/([^/.-]+)-([0-9])$ project/food/restaurentProfile.php?rid=$4