I'm try to create a clean URL turning http://www.example.com/view/index.php?id=12345
into http://www.example.com/view/12345
by adding the following to my .htaccess file:
RewriteEngine On
RewriteRule ^view/([^/]*)$ view/index.php?id=$1 [L]
This returns the file name index.php
as opposed to 12345
however. My error log is clear and I can't see what could be the issue here - any ideas?
You need a conditional match there
RewriteEngine On
RewriteCond %{THE_REQUEST} ^(?:GET|POST)\ /view/([^/\s?]+) [NC]
RewriteRule ^ view/index.php?id=%1 [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.