简体   繁体   中英

.htaccess mod_rewrite not working in localhost

I have Enabled mod_rewrite but still .htaccess is not working . It is not effecting but if i write something wrong in .htaccess file then it does show server error. In my htdocs i have folder called myfile .

RewriteEngine On 
RewriteRule ^myfile/PHP/project/$ /myfile/PHP/project/about.php

If you are placing .htaccess file in project directory then use following code,

RewriteEngine On 
RewriteRule ^\.*$ /myfile/PHP/project/about.php

The code in your question only work if the .htaccess file is placed public root directory.

Also, to disable directory listing add following code (case-sensitive) in .htaccess file.

Options -Indexes

您必须将“ AllowOverride”设置为“ all”,并将此“ Options FollowSymLinks”添加到您的virtualhost或httpd.conf中

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