c_pattle Posted May 18, 2011 Share Posted May 18, 2011 I've just enable mod_rewrite and tested it's all working fine and now I want to put it in actions. I have a page called "review.php" that takes a review id which is a number. So for example the url might be "review.php?review=123". I want to change this so the url would be "review/123/" however I'm having some trouble with my rewrite rule. RewriteEngine on RewriteRule ^review/([0-9]+)/?$ review.php?review=$1 When I type in "review/123/" I get taken to the review.php page but the review parameter doesn't seem to work. Also when I get to the review.php page all of the css has been displayed. Does anyone know why this is happened? Thanks for any help. Quote Link to comment https://forums.phpfreaks.com/topic/236799-rewrite-rule-help/ Share on other sites More sharing options...
requinix Posted May 18, 2011 Share Posted May 18, 2011 Add an [R] flag after the Rule. The browser will then show what URL it redirects to. RewriteRule ^review/([0-9]+)/?$ review.php?review=$1 [R] Your CSS isn't working because you're using relative paths, like The browser is looking for it at /review/foo/bar.css instead of in /foo. Use absolute paths: Quote Link to comment https://forums.phpfreaks.com/topic/236799-rewrite-rule-help/#findComment-1217311 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.