我想更改网址
http://localhost/Self-Content/img.php?v=YQHsXMglC9A&fmt=hqdefault.jpg
至
http://localhost/Self-Content/bUTdUaVmj8o/mqdefault.jpg
我试试这个.htaccess
RewriteEngine On
RewriteCond %{THE_REQUEST} /img\.php\?v=([^\s]+) [NC]
RewriteCond %{THE_REQUEST} /img\.php\&fmt=([^\s]+) [NC]
RewriteRule ^ /%1? [NC,R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ img.php?v=$1 [QSA,L,NC]
RewriteRule ^([^/]+)/?$ img.php?v=&fmt=$1 [QSA,L,NC]
我正在使用Wamp但是当我尝试此代码时,我收到此错误
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
答案 0 :(得分:0)
在Self-Content/.htaccess
内有这样的内容:
RewriteEngine On
RewriteBase /Self-Content/
RewriteCond %{THE_REQUEST} /img\.php\?v=([^&\s]+)&fmt=([^&\s]+)\s [NC]
RewriteRule ^ %1/%2? [NC,R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ img.php?v=$1&fmt=$2 [QSA,L]