mod_rewrite 获取变量 returns 服务器错误 500
mod_rewrite get variable returns Server errors 500
我想做的是让 link 像这样显示
http://api.example.com/users/useridhere/
每当我尝试重写时,它都会给我一个服务器错误。
这是我当前的代码
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ index.php?id= [NC,L]
DirectoryIndex index.php?id=Nobody
如果有人能指出我做错了什么或 post 修复,我将不胜感激。
如果我没理解错的话,你想要请求并在浏览器中看到这个:
http://api.example.com/users/useridhere/
但显示内容为:
http://api.example.com/index.php?id=useridhere
如果这是准确的,那么在您的 [docroot]/.htaccess 中可能是这样的:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^users/([\w-]+)$ index.php?id= [NC,L]
我想做的是让 link 像这样显示
http://api.example.com/users/useridhere/
每当我尝试重写时,它都会给我一个服务器错误。
这是我当前的代码
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ index.php?id= [NC,L]
DirectoryIndex index.php?id=Nobody
如果有人能指出我做错了什么或 post 修复,我将不胜感激。
如果我没理解错的话,你想要请求并在浏览器中看到这个:
http://api.example.com/users/useridhere/
但显示内容为:
http://api.example.com/index.php?id=useridhere
如果这是准确的,那么在您的 [docroot]/.htaccess 中可能是这样的:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^users/([\w-]+)$ index.php?id= [NC,L]