url重写使用.htaccess无法正常工作

时间:2015-10-24 13:47:44

标签: php .htaccess mod-rewrite url-rewriting

我有三个网址

http://thewebby.net16.net/Welcome.php

http://thewebby.net16.net/AboutMe.php

http://thewebby.net16.net/Projects.php

如何将这些网址重写为

http://thewebby.net16.net/The-Webby-home/

http://thewebby.net16.net/Aboute-Me/

http://thewebby.net16.net/Check-out-my-portfolio-and-projects/

RewriteBase /
DirectoryIndex Welcome.php

RewriteEngine On    # Turn on the rewriting engine
RewriteRule    ^The-Webby-home/?$    Welcome.php   [NC,L]    # Handle requests for "TheWebby"/Aboute-Me/
RewriteRule    ^About-Me/?$    AboutMe.php   [NC,L]    # Handle requests for "TheWebby"

我在免费域中托管,因此错误页面未显示它被重定向到托管服务提供商提供的错误页面。当我尝试

http://localhost/TheWebby/About-Me/ 它成功重定向到AboutMe.php,但当我尝试导航到welcome.php时 网址变为

http://localhost/TheWebby/About-Me/The-Webby-home/

而不是

http://localhost/TheWebby/The-Webby-home/

0 个答案:

没有答案