DjMikeS Posted October 18, 2008 Share Posted October 18, 2008 Hi all, I've got a problem with mod_rewrite and I can't figure it out. I'm trying to rewrite http://dev.phison.nl/index.php?section=home to http://dev.phison.nl/section/home/ and for some reason I keep getting the dreaded 404 error. Also, my error.log shows a "File does not exist" error...leading me to think that mod_rewrite is not enabled...But when I open phpinfo() it does appear to be loaded... Can anyone help? Some files: .htaccess RewriteEngine On RewriteLog "/var/log/apache2/dev.phison.nl/rewrite.log" RewriteLogLevel 3 RewriteRule ^/(.*)/ index.php?section=$1 My virtualhost file: <VirtualHost *:80> ServerName dev.phison.nl DocumentRoot /var/www/dev.phison.nl ServerAdmin [email protected] Options +ExecCGI FollowSymLinks Indexes ErrorLog /var/log/apache2/dev.phison.nl/error.log CustomLog /var/log/apache2/dev.phison.nl/access.log combined <Directory /var/www/downloads.phison.nl/*> AllowOverride All </Directory> Am I missing something ? Link to comment https://forums.phpfreaks.com/topic/128976-solved-mod_rewrite-doesnt-rewrite-url/ Share on other sites More sharing options...
JasonLewis Posted October 19, 2008 Share Posted October 19, 2008 Try this: RewriteRule ^section/([^/\.]+)/?$ index.php?section=$1 [L] Link to comment https://forums.phpfreaks.com/topic/128976-solved-mod_rewrite-doesnt-rewrite-url/#findComment-668868 Share on other sites More sharing options...
DjMikeS Posted October 19, 2008 Author Share Posted October 19, 2008 I've tried that and it works, but now I don't get any stylesheets and images...It rewrites every single file... My .htaccess RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f [OR] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^section/([^/\.]+)$ index.php?section=$1 [L,QSA] example: http://dev.phison.nl/section/home As you can see it does load the correct page, it only fails to load the images, jscripts and stylesheets... Do anyone know how to correct this ? Link to comment https://forums.phpfreaks.com/topic/128976-solved-mod_rewrite-doesnt-rewrite-url/#findComment-669120 Share on other sites More sharing options...
JasonLewis Posted October 19, 2008 Share Posted October 19, 2008 Give images/styles/scripts, basically any link, the full link. I don't know of any mod_rewrite way, there might be. Link to comment https://forums.phpfreaks.com/topic/128976-solved-mod_rewrite-doesnt-rewrite-url/#findComment-669125 Share on other sites More sharing options...
DjMikeS Posted October 19, 2008 Author Share Posted October 19, 2008 Ahh, that works great...thnx a lot ! Link to comment https://forums.phpfreaks.com/topic/128976-solved-mod_rewrite-doesnt-rewrite-url/#findComment-669171 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.