Forum Moderators: phranque
example
old dynamic url = www.example.com/example.php/number/catid/catname/subcatid/subcatname/articletitle
new dynamic url = www.example.com/newfolder/example.php/number/catid/catname/subcatid/subcatname/articletitle
Please what should the redirect code be in .htaccess.
Thanks
i like you suggestion but couple of questions/point
1] does this mean if i rewrite url to a short one google will have to re-crawl my site..160k urls
2] how long will this take
3] implication on SE ranking and current url have keywords in them
4] are there any gain over a short url to a long one..
5] urls have already be taking = backlinks...
what do u think...
An internal rewrite takes an external request for a URL, translates that in to an internal filepath, and grabs that content without exposing that internal filepath to the outside world.
An external redirect tells a browser to make a new request for a different URL. The new URL is the one that will get indexed by search engines.
.
You can't "rewrite URL to a short one". That would be a redirect. A request for one URL is redirected to a different URL.
You already asked about redirecting a long URL to an even longer URL.
I am suggesting that you use "short URLs" on your site, and have short URLs in all the links on your site.
The short URLs would be rewritten by .htaccess to pull content from the longer internal filepath, without exposing what that internal filepath actually is.
Requests for the old, long, URLs would be redirected to the new, short, URLs, preserving traffic that still requests those old URLs, and transferring (most of the) PageRank over to the new URLs.
It's a lot of work for a long term benefit. There is a short-term dip (sometimes a few months long) in traffic while the changeover is reindexed.
Messing this up can totally destroy your indexing and ranking. You get one (ONE) chance to get it right.
However, going back to your very first question. You asked for a redirect.
Your redirect would call for all new URLs for the pages of the site anyway.
Are you sure that is what you wanted?
I now suspect that what you want to do is keep all the URLs the same, but your site is now housed in a different folder on the server to the one that it used to be in.
In that case you need the pages of your site to have links on them with the same URLs as they have always had. You will then need an internal rewrite to take those URL requests and translate them into the new internal filepath for the content. The content is then pulled from there, without exposing to the browser what that internal filepath actually is.
That's a rewrite, rather than the redirect that you originally asked for.
.
In that case the original question would have been:
My old site was stored on the server in this path:
/example.php/number/catid/catname/subcatid/subcatname/articletitle
The URLs indexed by Google are like this:
www.example.com/example.php/number/catid/catname/subcatid/subcatname/articletitle
I need to keep the URLs the same, but my content is now stored on the server in a different place:
/newfolder/example.php/number/catid/catname/subcatid/subcatname/articletitle
How do I do that?
.
Terminology is key here:
- rewrite vs. redirect
- URL vs. internal filepath
Only when we know what the question actually is, can the right answer be supplied.
In general:
- we can redirect one URL request over to another URL, and
- we can rewrite a URL request to an internal filepath.
The two things only differ by the inclusion of both an [R=301] and the target domain name in the RewriteRule for the redirect - and by the lack of both of those things for the rewrite.
wow..am trying to get my head around this but the background here was that i created mobile pages for my articles and they are now place in a new folder.
This means the original mobile pages url are showing error code 404. But if you include the new folder name in the old url it works. hence me wanting to do a redirect from the old [not working url] to the new one [including new folder name in url]. An yes you are right, the new url is longer.
regarding short url vs long one. i wasn't thinking in that context but was wandering the implications and impact. but i will keep that for future to do list.
but seriously to my question [3] & [4] what would you say.
If so, then you need a redirect from the old URLs to the new URLs. At that point, none of your old URLs will serve content any more, and will be dropped by search engines. However, at the same time, I would shorten those new URLs too (using a rewrite to connect a short URL to the real internal filepath).
If you want the old URLs to stay indexed, then you need a rewrite to connect the old URLs to the new internal filepath for that content.
The old URLs are already indexed by Google, etc. I expect you want to keep them the same.
Which URLs appear in the links on the new site, the old ones or the new ones? The links on your pages define the URLs that Google, etc, will try to be indexing. However they will also still be re-crawling all the URLs that they already know about.
You would be better off with a rewrite to connect the already indexed URLs with the new internal filepath on the server. The rewrite does not expose what that filepath is.
It would have been quite easy to keep the same URLs and have a rewrite which connected the old URL requests with the new internal folder structure, without revealing what that new folder structure actually was.
In other words, no new URLs, and no change to the site as far as any of your visitors, or bots, were concerned.