我想所有的HTTP请求重定向到一个文件 Controller.php这样
I want to redirect all http request to one file controller.php
# My .htaccess
RewriteCond %{REQUEST_URI} !.(.+)$
RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]
RewriteRule ^([a-zA-Z0-9_-]+)$ controller.php
考虑这一请求 http://mysite.com/en-US/messages/new/
我有PHP脚本来获取所有的URL参数,并把它们
Controller.php这样
是被显示,但404响应code由阿帕奇送出过。
我怎样才能成为一个好重写规则,以prevent 404回应?
Consider this request http://mysite.com/en-US/messages/new/
I have php script to get all url parameters and treat them
controller.php
is been displayed but a 404 response code is sent too by Apache.
How can I make a good rewrite rule to prevent 404 response ?
您的正则表达式不包括 /
字符。
You regex doesn't include /
characters.
RewriteRule ^([a-zA-Z0-9_-/]+)$ controller.php
上一篇:使用浏览器的URL prevent直接访问图像图像、浏览器、直接、prevent
下一篇:设置在.htaccess display_error PHP配置htaccess、display_error、PHP