Welcome to WebmasterWorld Guest from 54.144.48.252

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

URL Rewriting

url rewriting

     
4:03 am on Feb 15, 2010 (gmt 0)

5+ Year Member



Hello friends, i want one of my site to be url rewritten.
i m not noob in this, but want ur opinion abt this what is im doing right or wrong?

Current case:
suppose i have a site example.com which is mobile content download site

how it works as first it show category, and sub cats and subsub cats so the current url of my working site is

www.example.com/index.php?do=showCat&catID=1&doEngine=postComment

so i apparently have three arguments 1) do, 2)catID and 3) doEngine

Now,
Q-1: i want it to rewrite as

exmple.com/video/1

where video is category with catID=1,

so how do i reformate it with www.example.com/index.php?do=showCat&catID=1&doEngine=postComment to exmple.com/video/1

i mean i dont want to show the arguments like do and doEngine?
so is it possible, ahh i mean how do i do that?

i want to use the catID (which is numeric), so i can get it fetched from db, instead of catName which can contain spaces , puntuations etc so i dont want it as reference to do fetching from db, so what to do next?


Your help is greatly appriciated.
Thanks
1:51 pm on Feb 15, 2010 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



You need to modify the script that generates the links that appear on your pages so that it produces the "SEO friendly" static URLs like /video/1. Links on your pages *define* the URLs, and mod_rewrite cannot change your page content.

Aftr changing your on-page links, you will then add a rewriterule to internally rewrite (not redirect) client requests for those 'friendly/static' URLs to the dynamic script filepath required to generate the correct page for that URL.

Having done both of these steps, you can optionally add a second rule that redirects only direct client requests for the 'old' dynamic/unfriendly URL to the new friendly/static URL. But this is an optional third step, and will not solve your main problem.

If you need to show "CatName" in the URL, then you'll need to do everything except the internal rewrite inside your script: Without scripting support, mod_rewrite does not have access to your database, and so cannot 'translate' a CatName to a CatID or vice-versa.

More details in this thread [webmasterworld.com] in our Apache Forum Library.

Jim
6:36 pm on Feb 15, 2010 (gmt 0)

5+ Year Member



@djMorgan, i got what u said, i know i have to reformate the internal link, which is not the issue, but there is i cant decide one thing

the current scenario is, that i m getting category from category ID, after url written done i still want category to be fetched from category id(bcos its going to be increase as time grows, ) so my current site look like this :

example.com/index.php?do=showCat&catID=1$pageNo=5$doEngine=comment

thie above url in my site produces as below(assuming cat ID = boelongs to Video (it is cat name)) with pageNo=1 appended to it:

Welcome to Video section:
>> New Videos
>> Uploaded Videos
>> etc etc..

but i want thing to be done as:

example.com/video/1

where : video=the cat name and 1= page no

the problem is i have multiple do arguments, like somethime do=schoCat and some thime its do=showSubCat

so how do i eliminate the "do" and "doEngine" arguments with being used?

or i have to use like:
exaple.com/showCat/video-1/5/comment

where: showCat=do, video=cat name, 1=cat id and comment=doEngine

help me , i m stuck in getting best(faint):
Great Thanks
7:10 pm on Feb 15, 2010 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



> so how do i eliminate the "do" and "doEngine" arguments with being used?

You probably cannot eliminate them completely, because if you did, then the rewriterule would have no idea which script parameters to add, or what their values should be. The "new" URL must contain all of the information (but not necessarily all the text or the same text) as the old URL.

For example, you could shorten "showcat" and "showprod" to "sc" and "sp", and since the last 'thing' in the new URL is always a "doengine" parameter, you could just leave that alone.

example.com/sc/video-1/5/comment -> /index.php?do=showCat&catID=video-1&pageNo=5&doEngine=comment

RewriteRule /sc/([^/]+)/([0-9]+)/([a-z]+)$ /index.php?do=showCat&catID=$1&pageNo=$2&doEngine=$3 [L]

Jim
7:43 pm on Feb 15, 2010 (gmt 0)

5+ Year Member



Thanks 4 undrstanding what i said, ok then i'll use like
example.com/showCat/video-1/5

still a question, so what url schema u prefer to be 4 seo?
1) example.com/showCat/video-1/5

2) video.example.com/showCat/1/5

3) example.com/video/showCat/1/5

or the change of args doesnt affects the SEO at all?

Thanks.
10:40 pm on Feb 15, 2010 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



That depends on whether "video-1" is "real" or not. If it is actually a video title that someone might search for, then it might be useful to put it first in the URL-path.

I consider keyword-in-URL to be a fairly "weak" SEO factor, but it is a strong "click-through" factor, since the keywords get highlighted (bolded) in search results.

Again, you can shorten "ShowCat" to "sc" -- I doubt that anyone searches for that, except perhaps cat-fanciers (and I doubt that's your main market).

Jim
2:16 am on Feb 16, 2010 (gmt 0)

5+ Year Member



lol, cat-fancier is not my main market. Mate i have got an idea, If i only use catname for fetching data?
Ie,
example.com/video
alternate to example.com/index.php?CatName=video
yeah, i also need to modify script, @djMorgan, mate so u bet on what i said?
 

Featured Threads

Hot Threads This Week

Hot Threads This Month