Below are the example links with current sub directories, as you can see below the htaccess code I'm using
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
currently only does the trick for - https://www.example.com/folder1/folder2/page
but not with - https://www.example.com/folder1/page.php
I'm trying to get both directories to eliminate the .php extension. Any idea how to go about this, as I have no idea how to do this. Thanks in advance
i think if %{REQUEST_FILENAME}.php
is not good function. but you can try this
RewriteCond $1 !^(index\.php|images)
RewriteRule ^(.*)$ /folder1/folder2/index.php?$1 [L]
this script will give you output like https://www.example.com/folder1/folder2/your_name_url
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.