Jump to content

[SOLVED] mod_rewrite doesn't rewrite URL


DjMikeS

Recommended Posts

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

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 ?

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.