Jump to content

Rewrite - following forward slash


wwfc_barmy_army

Recommended Posts

Hello.

 

I have this rewrite code:

 

Options +FollowSymLinks
RewriteEngine on

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([0-9]+)$ index.php?id=$1 [QSA,L]
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)$ index.php?id=$1&width=$2&height=$3 [L,QSA]

 

It works if i go to say:

mydomain.com/1

but not if i go to:

mydomain.com/1/

 

To take care of the following slash can i just do this:

 

Options +FollowSymLinks
RewriteEngine on

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([0-9]+)$ index.php?id=$1 [QSA,L]
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)$ index.php?id=$1&width=$2&height=$3 [L,QSA]
RewriteRule ^([0-9]+)/$ index.php?id=$1 [QSA,L]
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/$ index.php?id=$1&width=$2&height=$3 [L,QSA]

 

Would that work or cause errors?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/170789-rewrite-following-forward-slash/
Share on other sites

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.