Jump to content

RewriteRule not working - trailing slash & another problem


Masca

Recommended Posts

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

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 "-".

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.