简体   繁体   中英

PHP serving pages for URLs with no extension

I have an OS X Snow Leopard Server that I use for development. I noticed that if I access http://site.com/page it serves page.php even though there is no .htaccess file that rewrites the URLs.

I would like to disable this option as it's not really something I want.

Thanks!

Later edit: The solution I noticed to work best is Options -MultiViews in .htaccess . Thanks to all!

如果不需要重写mod,则应通过从apache文件夹下的enabled-modules中删除rewrite.conf来禁用它。

As suggested you'll want to disable the rewrite module. On a Mac you'll do this by commenting out the line LoadModule rewrite_module libexec/apache2/mod_rewrite.so (put a semicolon on the beginning of the line) in the file /etc/apache2/httpd.conf .

Remember that you need root access to change this file, eg sudo <favourite text editor> /etc/apache2/httpd.conf

Then restart apache with sudo apachectl restart

Check your apache conf file and see if there are any rewrite settings there. Also check in any virtual host sections.

surely in the apache server config files.

For development you can use also mamp for example :

mamp

User mario answered my question, but since he did so in a comment I cannot accept that answer. I up-voted his comment, but I'm going to post the solution here, so anyone looking for something similar will find it easier:

options -multiviews

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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