Jump to content

mod_rewrite doesn's work


Lay-C

Recommended Posts

Hello

 

I tried to rewrite my URL by using mod_rewrite, but since I'm new to Apache and mod_rewrite I don'T know how to work it.

 

in my httpd.conf (/etc/apache2/httpd.conf) there are the following lines:

LoadModule rewrite_module modules/ApacheModuleRewrite.dll
     RewriteEngine On
     RewriteLog "/home/dominik/rewrite.log"
     RewriteLogLevel 9
     RewriteRule (*.).html /index.php?site=$1

 

If I now call http://localhost/registration.html there is the following error:

 

Not Found

 

The requested URL /registration.html was not found on this server.

Apache/2 Server at localhost Port 80

Link to comment
https://forums.phpfreaks.com/topic/122698-mod_rewrite-doesns-work/
Share on other sites

That shouldn't be in your httpd.conf file (I don't think).

What you need is a .htaccess file where you turn the RewriteEngine On. But make sure you have the rewrite_module loaded in httpd.conf (which is the first line in your code).

 

Everything else though should be in a .htaccess file.

It still doesn't work...

 

RewriteEngine On

RewriteLog "/home/myname/rewrite.log"

RewriteLogLevel 9

RewriteRule (*.)\.html /index.php?site=$1

That's the content of the .htaccess which is located the same folder the index.php is.

 

The httpd.conf in /etc/apache2/ is attached.

 

[attachment deleted by admin]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.