htaccess rewrite rule needed for example.com/xxx/xxx

时间:2015-06-26 09:34:26

标签: apache mod-rewrite redirect

I need a rewrite rue to redirect below

www.example.com/45678/2323

to below

www.example.com/view_basket.php?order_id=45678&pin=2323

I'm using below code but it seems there is a problem with base URL as when I'm suing this rewrite rule images on my page are not loading, images on my page has simple relative path like below

<img src="image.jpg">

or

<img src="folder/image.jpg">

Here is my rewrite rule

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(?!www\.)(.+) [NC]
RewriteRule ^(.*) http://www.%1/$1 [R=301,NE,L]
RewriteRule ^([^/]*)/([^/]*)$ /view_basket.php?order_id=$1&pin=$2 [L]

0 个答案:

没有答案