Masca Posted July 27, 2007 Share Posted July 27, 2007 Hi! Please help! I have two odd problems with my RewriteRules which I just do not seem to be able to resolve: PROBLEM 1: I want to add a trailing slash to a url such as test/1234 (therefore rewriting it to test/1234/). My RewriteRule rule is: RewriteRule ^(.*)([0-9]{4})$ $1$2/ [R] but, the last slash in the rule is currently being ignored. However, the following: RewriteRule ^(.*)([0-9]{4})$ $1$2// [R] results in test/1234// using the above exmaple. Why is this? PROBLEM 2: Why does (a) below work, but (b) below not work? I would like to use (b). (a) RewriteRule ^foo-bar/([A-Za-z]+)/$ foobar.php?type=$1 [L] - working (b) RewriteRule ^foobar/([A-Za-z]+)/$ foobar.php?type=$1 [L] - not working The only difference is the hyphen in (a). TIA Link to comment https://forums.phpfreaks.com/topic/62006-rewriterule-not-working-trailing-slash-another-problem/ Share on other sites More sharing options...
hackerkts Posted July 28, 2007 Share Posted July 28, 2007 It would be a better idea if you provide your dynamic URL and static URL you want it to be. RewriteRule ^([a-zA-Z]+)/([0-9]+){4}/$ NYNAMIC-URL For (a), it will work only if you goes to http://domain.tld/foo-bar/ASDAS/ as for (b), it's http://domain.tld/foobar/ASDASD/ Take note of the "-". Link to comment https://forums.phpfreaks.com/topic/62006-rewriterule-not-working-trailing-slash-another-problem/#findComment-309378 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.