For example, this: example.com/users.php?page=1 redirects to this: example.com/users/1
However, as i would expect, but do not want, this now means all my relative URLs, are appeneded to example.com/users/ making for example, example.com/users/image1.jpg which is not what i want as the image1.jpg is found at example.com/image1.jpg
Does this mean i cant use relative URLs with mod rewrite?
feyd wrote:Oh, I'm sorry, I misread your original post. You can use absolute path references e.g. /image1.jpg
Do you mean, "You can use relative path references" ? - as the example you provided is relative and that was my question...
Anyway. I have another question How would i do this?
Also, is it possible to make to make redirect rules actually change the link written on the page? For example, /user.php?id=1 redirects to /user/1 , but the link on the page still displays as /user.php?id=1 . Is it possible to change the displayed link on the page using mod rewrite?
<img src="/image1.jpg" /> vs. <img src="../image1.jpg" /> vs. <img src="image1.jpg" />
Ah thank you I didn't know that. It helps alot. I have admitted the leading slash on all my links on all pages lol... /me sighs... i guess i have alot of work ahead of me converting them all
Now about links. Obviously, where there is a link shown to the user, i would prefer that it is displayed as user/1 . Do you think i should write the links as /user/1 in my code ( rather than /user.php?id=1 )? ...or, is there a way to make redirect rules actually change the link written on the page? ...and if so, is there much overhead in doing this?
I would suggest writing some code, a function, to generate the url for you. That way a simple toggle or change can switch from "/user/1" to "/user.php?id=1" .. most of your URL's would need to go through this function.
Shears wrote:Hmm. I have concluded that this is impossible - especially if you are dealing with files of a varying number of variables...
It is quite possible, but you need to start clean. I use a single function that I literally pass every link through so it gets written the way my config tells it to be. This is, of course only a glimpse of the logic, but you get the idea from this...