Forum Moderators: phranque
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.
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.