Ankit Rana
Ankit Rana

Reputation: 53

missing images after url rewrite

I am rewriting the URL from example.com/service.php?p_id=1&s_id=seo to example.com/1/seo/. The rule is given below:

RewriteEngine On

RewriteCond %{THE_REQUEST} /services\.php\?p_id=([^&\s]+)&s_id=([^&\s]+) [NC]    
RewriteRule ^ /%1/%2/? [R=302,L]

RewriteRule ^([^/]+)/([^/]+)/?$ services.php?p_id=$1&s_id=$2 [NC,QSA,L]

On the page service.php I use base href="/" for absolute path. Now, on some pages images is missing. How do I fix this problem? The page in question can be found at http://www.example.com/packages.php

Upvotes: 2

Views: 391

Answers (2)

anubhava
anubhava

Reputation: 785196

Try this code:

RewriteEngine On

RewriteCond %{THE_REQUEST} /services\.php\?p_id=([^&\s]+)&s_id=([^&\s]+) [NC]    
RewriteRule ^ /%1/%2/? [R=302,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/?$ services.php?p_id=$1&s_id=$2 [QSA,L]

And make sure there are no other rules besides this.

Upvotes: 2

Vivek Pipaliya
Vivek Pipaliya

Reputation: 498

Solved !

Give Full path to the src attribute of img Tag and href attribute of tag.

For Example :

Use <img src="http://www.magickeyinfotech.com/images/magickey-infotech-logo.png"> Insetad Of <img src="images/magickey-infotech-logo.png">

Upvotes: 0

Related Questions