Jump to content

/articles/ instead of articles.php


UnknownPlayer

Recommended Posts

Now it works, but css is not loaded, how can i fix that?

This is the code:

RewriteEngine on
RewriteRule ^vest/([^/\.]+)/?$ vesti.php?id=$1 [L]

And can i make when someone go to http://localhost/vesti.php?id=$id, to redirect to http://localhost/vest/$id ?

Hi there, I had the same problem, Google knew the answer.

 

The css isn't loaded because its path also gets rewritten. To solve this, you have to put in a rewrite condition:

RewriteCond %{REQUEST_URI} !\.(css|jpg|gif|png|js)$ [NC]

 

though that didn't work for me. Using full path names does work though; instead of file.css use http://localhost/sitename/file.css

Here is how I would do it

 

first turn on the RewriteEngine

RewriteEngine on

 

To solve the problem with css and images don't rewrite existing files

RewriteCond %{REQUEST_FILENAME} !-f

 

Assuming your 'id' is an integer you would want to do something like this

RewriteRule ^vest/([0-9]+)$ vesti.php?id=$1 [L]

 

This should rewrite urls like /vest/123 to vesti.php?id=123 . I didn't test this but it should work without any problems

 

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.