I'm trying to create a .htaccess file that needs to see the directories as 1 variable: ex. http://example.com/this-is-page-one/sub-dir
will pass this-is-page-one/sub-dir
as a variable to PHP.
I have this at the moment:
Options +FollowSymLinks
RewriteEngine on
# Page rewriting
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /page.php?url=$1
# Add trailing slash to urls
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule ^(.*)$ %{REQUEST_URI}/ [R=301,L]
This works fine as long as you type a trailing slash behind the URL. But as you can see the htaccess will put a trailing slash behind the URL for you. When that happens, it automatically puts the ?url=
variable behind it.
ec. http://example.com/this-is-page-one/sub-dir/?url=this-is-page-one/sub-dir
Does someone see what I do wrong?