Search code examples
.htaccessmod-rewritewampinternal-server-error

Adding rewrite rules to .htaccess gives server error


I have added the following lines to my .htaccess file:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !^(.+)\.css$ [NC]
RewriteRule ^http://127.0.0.1(.*)$ http://127.0.0.1/getcss.php?$1/$2 [L,NC]
RewriteCond %{HTTP_COOKIE} ^.*site-cookie=([^;]+)$ [NC]
RewriteRule ^http://127.0.0.1(.*)$ http://127.0.0.1/cloked.php?$1/$2 [L,NC]
RewriteCond %{http_COOKIE} ^.*site-cookie=!([^;]+) [NC]
RewriteRule ^(.*)$ htp://127.0.0.1/noaccess.php?$1 [NC]

It gives me "index.php". This is a WAMP installation with Apache 2.2.11(win) - php 5.3.0.


Solution

  • If you want to use rewrite rules, you need to enable the rewrite module of Apache. How to do this depends on which installation of Apache you use. Wamp allows you to do this via the configuration menu.