Jump to content

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

 

What is problem there ? :S

I'm on localhost, maybe that is problem ?

 

Seriously? You have been given several different examples that should work with small modifications.

 

Please don't be this guy -

But in 2 ways images doesn't work ?

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.