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
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.

Link to comment
Share on other sites

That still doesn't help.

I made an .htaccess in the same folder the index.php is located.

 

Another thing I noticed is that the phpinfo(); doesn't show mod_rewrite in Loaded Modules of apache2handler table although I still have the lines in the httpd.conf

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.