Jump to content

Recommended Posts

Hi all

 

I am trying to re-write the following URLs:

 

The first I have managed OK:

 

http://www.peten.co.uk/clientarea/ford/?page=new-car

 

To:

 

http://www.peten.co.uk/clientarea/ford/new-car

 

By doing this: RewriteRule ^([A-Za-z\-]+)$ ?page=$1 [QSA]

 

However, my next URL is:

 

http://www.peten.co.uk/clientarea/ford/?page=new-car&vehicle=ford-ka

 

I want this to become:

 

http://www.peten.co.uk/clientarea/ford/new-car/vehicle/ford-ka

 

I can't seem to get this to be re-written? I have tried:

 

RewriteRule (.*)/(.*)/ index.php?page=$1&vehicle=$2

 

But his ruins all my images and some don't load?

 

Can you help me re-write the URL?

 

Many thanks

 

Pete

Link to comment
https://forums.phpfreaks.com/topic/270130-mod-rewrite-on-two-query-strings/
Share on other sites

It sounds like your issue is not with the re-write stuff, but with your HTML.  You need to change how you reference your images so that they will work with the new URL style.  For example if you're old url was http://www.peten.co.uk/clientarea/ford/?page=new-car and you're image take is like so:

<img src="../../images/blah.jpg">

 

Then it will be searching for the image at http://www.peten.co.uk/images/blah.jpg.

 

Once you implement you're rewrite rules and the page's URL becomes http://www.peten.co.uk/clientarea/ford/new-car/vehicle/ford-ka, that same image tag is going to be looking for the image at http://www.peten.co.uk/clientarea/ford/images/blah.jpg

 

What you need to do is update the image URL's so they are correct using the new format.  The easiest way to manage that would be to use an absolute url or a relative-to-root path, eg:

<img src="http://www.peten.co.uk/images/blah.jpg">
or
<img src="/images/blah.jpg">

 

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.