I have a Subdirecotory in my webroot with some PHP files ( www/services/files.php ).
Current url: http://example.com/index.php?pageID=services/myservice
I would like it to be: http://example.com/services/myservice
My code:
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?pageID=/services$1 [L,QSA]
You want to make it appear as two subfolers so I would use this code for that type of URL structure. Using an .* would be too greedy.
This will allow you to use http://example.com/services/myservice
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?pageID=$1/$2 [L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.