Forum Moderators: phranque

Message Too Old, No Replies

image and other link on page get changed

image path changed,link changed

         

dipan

10:13 am on Oct 6, 2008 (gmt 0)

10+ Year Member



hi everyone

i am facing problem of image path changed after rewriting below code in .htaccess file.

i tried a lot but fail somehow.

your help will be appreciable.

Here is my code of .htaccess file

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([0-9]+)/([a-zA-Z0-9_-]+)\.html$ cms.php?id=$1

this regular expression change the url like

if you have type [youtsite.com...]
then it will call cms.php?id=12

it doing that thing perfectly.
but images, css and other link in menu gets changed.

e.g. other link now get changed like
[youtsite.com...]
but original link was
[youtsite.com...]

In image case original path was
./images/aboutuLogo.jpg

gets changed
./12/images/aboutuLogo.jpg

Please help me out buddies.

Thanks in advance.

g1smd

10:21 am on Oct 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Relative URLs for images and other files are resolved by the browser relative to the URL of the HTML page they are called from.

In most cases, simply changing those links to start with a / and then specify the full path to the file is enough to fix everything.

That is, change it to be /images/about.jpg instead.

You may need to apply the same fixes to calls for your stylesheet and JavaScript files too.

Never use relative links. They always fail for rewritten URLs.

dipan

10:33 am on Oct 6, 2008 (gmt 0)

10+ Year Member



hi buddy
i tried that too. but it didnt work.
ne other solution for it.?

dipan

10:40 am on Oct 6, 2008 (gmt 0)

10+ Year Member



hi g1smd
its done.
i made mistake while giving full path.
thanks dear...
stay tune with .htaccess file