It's probably a silly question but I have no idea where to look for answers. I don't even know how these type of links are called in order for me to make a google search. I've been a web based application developer for a few years now but as all my apps where for intranet use only I have no real web knowledge.
I have noticed different types of urls when navigating websites and I was wondering how do they work and which is the safest to prevent injections and other stuff. Let me give an example for you to understand what I don't know.
Let's say we have a website like this: http://www.site.com/index.php?page=news&news_id=123 How do you make the link look like this: http://www.site.come/news/123 or http://www.site.come/news/news_title or http://www.site.come/news/news_title.html
Another example would be links to posts on blogger or wordpress which look like name.blogger.com/2009/post-title.html
I believe some encoding/decoding is involved but have no idea where to look for some more info. Is my question related to permalinks?
Some literature would be very helpful. Thanks a lot.
Links and navigation
Moderator: General Moderators
-
andrei.mita
- Forum Commoner
- Posts: 65
- Joined: Sun May 08, 2005 4:06 am
- Location: Barlad/Romania
Re: Links and navigation
It's called URL rewriting.
Permalinks are kinda related: most of the time those links are friendly so they get rewritten into something more functional.
Permalinks are kinda related: most of the time those links are friendly so they get rewritten into something more functional.
-
andrei.mita
- Forum Commoner
- Posts: 65
- Joined: Sun May 08, 2005 4:06 am
- Location: Barlad/Romania
Re: Links and navigation
Searching again and again the web I did came across url rewriting and mod_rewrite in apache but I wasn't sure. Thanks for the confirmation. The second question: which is the safest? The classics index.php?page=news&news_id=123 or /news/123?
Thanks
Thanks
Re: Links and navigation
Safest regarding what? Browser doesn't care what it is. With the rewriting, PHP doesn't care either.
Regarding longevity? What will change first: filenames or a URL naming scheme? There's more to it than just that.
Changing the URL scheme is okay - you simply have two rules now: one for the former (to support the people who have kept track of the old links) and one for the current. You don't really need to worry about changing the URLs around.
Files are harder. If you change display.php to view.php, then (a) you have two copies of the same code floating around, or (b) you have display.php simply include() view.php. But either way it's a hassle.
Regarding users? SEO (search engine optimization) is a big buzzword, but for once it actually has a real meaning. What do you think your grandmother would remember better: "index.php?page=news&news_id=123" or "/news/123"? The answer is obvious.
How about that or "/news/the-title-of-the-article-123"? It's longer but it means more to a person. And to a search engine. If the engine likes it more then you'll get a higher ranking in search results.
Blah blah blah.
The "better" the URL looks the better it is overall. For people, for search engines, for possible future problems...
Regarding longevity? What will change first: filenames or a URL naming scheme? There's more to it than just that.
Changing the URL scheme is okay - you simply have two rules now: one for the former (to support the people who have kept track of the old links) and one for the current. You don't really need to worry about changing the URLs around.
Files are harder. If you change display.php to view.php, then (a) you have two copies of the same code floating around, or (b) you have display.php simply include() view.php. But either way it's a hassle.
Regarding users? SEO (search engine optimization) is a big buzzword, but for once it actually has a real meaning. What do you think your grandmother would remember better: "index.php?page=news&news_id=123" or "/news/123"? The answer is obvious.
How about that or "/news/the-title-of-the-article-123"? It's longer but it means more to a person. And to a search engine. If the engine likes it more then you'll get a higher ranking in search results.
Blah blah blah.
The "better" the URL looks the better it is overall. For people, for search engines, for possible future problems...
-
andrei.mita
- Forum Commoner
- Posts: 65
- Joined: Sun May 08, 2005 4:06 am
- Location: Barlad/Romania
Re: Links and navigation
Your probably right. Pretty people attract more attention, so will urls. After that it's all about the content. From what I managed to read there is no problem from server side point of view if have rewrite on or off. Or is it?
Will the "ugly" links still work once rewrite is on?
Will the "ugly" links still work once rewrite is on?
Re: Links and navigation
If rewriting is on then there will be a little performance hit. Of course: something new is happening. But nothing you have to worry about.
Yes. Rules have some conditions they must meet: if the "ugly" links don't match any of those conditions then nothing special will happen to them.andrei.mita wrote:Will the "ugly" links still work once rewrite is on?
-
andrei.mita
- Forum Commoner
- Posts: 65
- Joined: Sun May 08, 2005 4:06 am
- Location: Barlad/Romania
Re: Links and navigation
Thanks a lot. Feeling smarter 