开发者

How do I make htaccess work in WAMP? [duplicate]

开发者 https://www.devze.com 2023-02-26 22:22 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How to use .htaccess in WAMP Server?
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How to use .htaccess in WAMP Server?

I'm using Wamp Server 2.0 on Windows 7 (32-bit) and want to make use of .htaccess files. I'm kinda new to server configs in general but from what I understand I have to "activate" usage of htaccess files in the httpd.conf file of Apache?

I have done the following:

In my httpd.conf file I've added these lines:

<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>

Then I created a .hta开发者_开发百科ccess file in my sites root directory with the following lines

RewriteEngine on
RewriteBase /

RewriteRule ^articles/([A-Za-z0-9-]+) /articles/index.php?slug=$1%{QUERY_STRING} [PT, L]

However, I keep getting 500 Internal Server Errors when I try to load up the page. If I comment out the RewriteRule it works though. I can't figure out what I'm doing wrong.


Remove the space in between the flags of your RewriteRule. Also, you will need a RewriteCond to avoid infinite redirects.

 RewriteCond %{REQUEST_URI} !index.php$
 RewriteRule ^articles/([A-Za-z0-9-]+) /articles/index.php?slug=$1%{QUERY_STRING} [PT,L]

Hope that helps.

0

精彩评论

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