htaccess redirect, mod_rewrite...

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I got a problem getting all redirects done as i wish.

I've managed to get the old urls to redirect to new urls, discard the
first 0 or 00 in the variable number (001 -> 1 and 010 -> 10) so
domain.tld/directory/255 redirects to domain.tld/directory/index.php?
file=255 and
domain.tld/directory/255/ redirects to domain.tld/directory/index.php?

This is the line I have currently in my .htaccess

RewriteRule ^0*([0-9]+)/?$ index.php?file=$1 [L]

The problem itself is, that the redirects to
...index.php?file=255/ and I need the / to be removed from the
new target url end because that is not working with the php code on
the page.

All I've found was a way to add the / (or anything else) in the end of
the new url, but not remove it.. You guys got any ideas ?

If I posted this in the wrong group, please advice me of correct group
and set the follow-ups properly.


 - Sami

Re: htaccess redirect, mod_rewrite...

Quoted text here. Click to load it

Hrm... Is the PHP code reading the $_GET['file'] as "255/"? If that's
the case, I suggest just removing it with PHP; it'll probably be less
stressful in the end. Otherwise, I got nothing D: I'm definitely not a
mod_rewrite expert

Site Timeline