开发者

.htaccess question: http://www.example.com/contact should show http://www.example.com/contact.php (without redirecting)

开发者 https://www.devze.com 2023-03-31 16:28 出处:网络
As said in the Title,I want that http://www.example.com/contact should show http://www.example.com/contact.php. And important: without redirecting.

As said in the Title,I want that http://www.example.com/contact should show http://www.example.com/contact.php. And important: without redirecting.

Unfortunately my .htaccess Code does not work:

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^contact$ contact.php [L]

What could be the rea开发者_开发百科son for this? Please help me out how to fix it :(!

EDIT: SOLVED. Google helped me out. Adding Options -Multiviews was the Solution. Thanks everyone!


I do believe you have to put the / at the beginning of contact because it's part of the path.

Try this:

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^/contact$ contact.php [L]


The only way to make the URL at the top show .php when going to the URL without PHP would be to redirect the browser to it. The easiest way to do that in most apache instances would be:

Redirect permanent /contact http://example.com/contact.php
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号