Lay-C Posted September 4, 2008 Share Posted September 4, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/122698-mod_rewrite-doesns-work/ Share on other sites More sharing options...
JasonLewis Posted September 4, 2008 Share Posted September 4, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/122698-mod_rewrite-doesns-work/#findComment-633630 Share on other sites More sharing options...
Lay-C Posted September 4, 2008 Author Share Posted September 4, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/122698-mod_rewrite-doesns-work/#findComment-633742 Share on other sites More sharing options...
corbin Posted September 4, 2008 Share Posted September 4, 2008 Try it with: RewriteRule (*.)\.html /index.php?site=$1 Quote Link to comment https://forums.phpfreaks.com/topic/122698-mod_rewrite-doesns-work/#findComment-634061 Share on other sites More sharing options...
DarkWater Posted September 4, 2008 Share Posted September 4, 2008 Corbin, look closely at the rewrite you've got (and he had in the original post). You have the * after the ., which is wrong. Quote Link to comment https://forums.phpfreaks.com/topic/122698-mod_rewrite-doesns-work/#findComment-634084 Share on other sites More sharing options...
corbin Posted September 5, 2008 Share Posted September 5, 2008 Ah! Didn't even see that lol. Quote Link to comment https://forums.phpfreaks.com/topic/122698-mod_rewrite-doesns-work/#findComment-634207 Share on other sites More sharing options...
Lay-C Posted September 5, 2008 Author Share Posted September 5, 2008 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] Quote Link to comment https://forums.phpfreaks.com/topic/122698-mod_rewrite-doesns-work/#findComment-634391 Share on other sites More sharing options...
corbin Posted September 5, 2008 Share Posted September 5, 2008 Try RewriteEngine On RewriteLog "/home/myname/rewrite.log" RewriteLogLevel 9 RewriteRule (.*)\.html /index.php?site=$1 Quote Link to comment https://forums.phpfreaks.com/topic/122698-mod_rewrite-doesns-work/#findComment-634467 Share on other sites More sharing options...
Lay-C Posted September 5, 2008 Author Share Posted September 5, 2008 Doesn't work that way either... Is the httpd.conf right and in the right folder? There is still the 404 Error. I don'T know what to do Quote Link to comment https://forums.phpfreaks.com/topic/122698-mod_rewrite-doesns-work/#findComment-634485 Share on other sites More sharing options...
corbin Posted September 6, 2008 Share Posted September 6, 2008 It works fine for me locally.... Quote Link to comment https://forums.phpfreaks.com/topic/122698-mod_rewrite-doesns-work/#findComment-635009 Share on other sites More sharing options...
Lay-C Posted September 6, 2008 Author Share Posted September 6, 2008 So the only thing I could think about is a mistake in the httpd.conf or a wrong location of the file Quote Link to comment https://forums.phpfreaks.com/topic/122698-mod_rewrite-doesns-work/#findComment-635129 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.