简体   繁体   中英

mod_rewrite not working?

So I'm trying to get mod_rewrite to work, using Apache2.2 on windows 7 I'm running it as a local server. All sites are accessed at http://localhost/ It's not working?

I created a simple .htaccess file and it won't work.

in the httpd.conf I changed it to

Options All AllowOverride ALL

Whats the problem?

Try writing garbage in your .htaccess file. This should cause a 5xx error message. If it does not then your AllowOverride All is at the wrong place in your config.

I would also suggest adding a (name based) virtualhost to keep your configuration at one place instead of modifying the defaults.

Just want to add to the above which is correct, I was also pulling my hair on a non-working .htaccess. After hours of testing and troubleshooting it turned out that, even though my Sublime Text 2 was set to UTF-8, somehow it was still carrying over hidden special characters that were the root cause of my problem. After copying & pasting .htaccess' contents into vim editor, removing those weird characters, then resaving things started working as should.

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