Reputation: 23
I have URLs like these pointing at folders:
1) https://try.com/documentation/license/
2) https://try.com/documentation/license
I want to rewrite both pointing at PHP/pages.php
I have tried this:
RewriteRule ^(.*)/$ PHP/pages.php [NC]
This works in case #1 but not in case #2.
I have also tried this:
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule PHP/pages.php [L]
This does not work at all.
The case is that the directory name is this:
/pages/documentation/license/
How to do this?
Upvotes: 2
Views: 216
Reputation: 133518
Place your .htaccess file into your pages directory/folder and place following rules in it. Also please clear your cache of your browser before testing your URLs.
RewriteEngine ON
RewriteRule ^documentation/license/?$ PHP/pages.php [NC,L]
For Generic rewrite: you could use following.
RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(.*)/?$ PHP/pages.php [NC,L]
Upvotes: 2