I am trying to figure those clean urls out again. I am trying to "convert"
http://www.website.com/videos.php?url=testurl
into
http://www.website.com/videos/testurl/
All of that works fine as long as I write the url without the / at the end. But for me it is really important to have the / at the end.
Here is my htaccess:
RewriteBase /
RewriteRule ^(.*)\/$ $1.php
RewriteRule videos/(.*)/?$ /videos.php?url=$1
Any help would be appreciated.
Have it this way:
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^videos/([^/]+)/?$ videos.php?url=$1 [L,QSA,NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
What you're looking for is rtrim:
$url = 'http://www.website.com/videos/testurl/';
$url = rtrim($url, '/');