Jump to content

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]

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.