0

I have the following URL's:

http://www.website.com/index.php?page=boat&id=1&lang=nl

index.php is my main file. The variable "page=" is used to show the right page.

I came up with the following rule:

RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*) /index.php?lang=$1&keyword=$2&page=$3&id=$3&model=$4 [L]

which changes the url to:

http://www.website.com/nl/yachts-for-sale/boat/1/princess-50

However I want the url to look like:

http://www.website.com/nl/yachts-for-sale/1/princess-50

As you can see without "boat" in the url. But this is an important variable because it decides which page to show.

How can I achieve this? The "yachts-for-sale" keyword is exclusive for the "boat" page. I was thinking about a Rewritemap, but that is not allowed in a .htaccess file.

1 Answer 1

2

You state that

The "yachts-for-sale" keyword is exclusive for the "boat" page

If you do not have that rule in your PHP, add it in your rewriteRule:

RewriteRule ^([^/]*)/(yachts-for-sale)/([^/]*)/([^/]*) /index.php?lang=$1&keyword=$2&page=boat&id=$3&model=$4 [L]
Sign up to request clarification or add additional context in comments.

1 Comment

No problem, could you mark my answer as the correct one? That way future users will know what to do and i get some bacon for helping you ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.