简体   繁体   English

.htaccess漂亮的URL导致404

[英].htaccess pretty URL resulting in 404

I would like to rewrite mypage.com/foo.php as mypage.com/foo . 我想将mypage.com/foo.php重写为mypage.com/foo My rewrite changes the URL correctly, however the resultant page is a 404. 我的重写正确地更改了URL,但结果页面是404。

Here's what I've got so far: 这是我到目前为止所得到的:

# Setup conditions for internal rewrite of Foo
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite for TDS
RewriteRule ^foo/$ /foo.php [L,QSA]

# External redirect for Foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+foo\.php [NC]
RewriteRule ^ /foo/? [R=301,L]

What am I missing to make this work? 我缺少什么让这项工作?

# Setup conditions for internal rewrite of Foo
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite for TDS
RewriteRule ^foo mypage.com/foo.php [L,QSA]

Try this.. 尝试这个..

If you're on Apache take a look at the error.log file, it should provide you with some useful information. 如果你在Apache上看一下error.log文件,它应该为你提供一些有用的信息。

If you're on a Windows Server, I am sure there is a similar log file to look at. 如果您使用的是Windows Server,我确信有一个类似的日志文件可供查看。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM