I want to change
example.com/modules/page/page.php
to
example.com/page
I have a RewriteRule that works partially, but there's a problem.
RewriteRule ^page/(\w+)/? modules/page/page.php?page_id=$1 [NC,L]
page.php can be accessed if I type example.com/page/randomstring
I want this to be valid for only example.com/page
How can I achieve that?
In your .htaccess file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9]+)$ modules/page/page.php?page_id=$1 [L,QSA]
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.