在Ubuntu的/ Mac上,去,说,本地主机/页自动重定向到localhost / page.php。
但是,这并不在Windows中工作。如何做才能让你的东西,如本地主机/航空自卫队重定向到localhost / asdf.php?
解决方案我假设你知道一个.htaccess文件。
您可以通过两种方法实现这一点:
方法1:
`#1加载页面asdf.php但
航空自卫队显示在地址栏
的RewriteBase /网站
重写规则^([^ / 。] +)?$ $ 1.PHP`
方法2:
`#2加载页面asdf.php和
显示asdf.php在地址栏。
在R标志告诉Apache重定向到
网址。
的RewriteBase /网站
重写规则^([^ / 。] +)?$ $ 1.PHP [R]`
我希望这会帮助你。
In Ubuntu/Mac, going to, say, localhost/page automatically redirects to localhost/page.php.
But this doesn't work in Windows. How do you make stuff like localhost/asdf redirect to localhost/asdf.php?
解决方案I am assuming that you know what an .htaccess file is.
You can achieve this by two methods:
Method 1:
`#1- Loads the page asdf.php but
displays asdf in the address bar
RewriteBase /site
RewriteRule ^([^/.]+)?$ $1.php `
Method 2:
`#2- Loads the page asdf.php and
displays asdf.php in the address bar.
The R flag tells Apache to redirect to the
url.
RewriteBase /site
RewriteRule ^([^/.]+)?$ $1.php [R]`
I hope this will help you.