Forum Moderators: phranque

Message Too Old, No Replies

url problems

pages losing pagerank

         

33marcus

12:05 am on Oct 4, 2012 (gmt 0)

10+ Year Member



I have recently redone my website in html and have a problem with my urls losing the page rank they previously had. For example the urls previously looked something like this www.mysite/page and to try and keep them like this i created a folder named "page" and named the page index.html. Now when the page loads it looks like this www.mysite/page/ but it still loads when you go to www.mysite/page minus the pagerank. Can someone please help.

g1smd

12:25 am on Oct 4, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You don't need to create folders, nor mess about with redirects.

Link to
href="/page"
from the pages of your site.

Use a
RewriteRule
in your htaccess file to match the URL request
^page$
to the internal file
/page.html
and add the usual
[L]
flag on the end.

lucy24

1:01 am on Oct 4, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



it looks like this www.mysite/page/ but it still loads when you go to www.mysite/page minus the pagerank

/page and /page/ are different things. One is an extensionless URL; the other is a directory. Or, in URL-final position, a directory's index page.

Your problem-- which I am sorry to say you created yourself-- is that the moment you made a /page/ directory, mod_dir stepped in and redirected all requests for /page to /page/ which in turn gets rewritten (not redirected) to /page/index.html. To prevent this from happening, you need to jump in with a rewrite of your own before mod_dir gets a chance to meddle with the /page request.

Uhm . Translate the preceding into IIS if necessary.The principle is the same.

33marcus

2:08 am on Oct 4, 2012 (gmt 0)

10+ Year Member



thanks, but the issue is ubiquitous throughout the site. I used page as generic example, but it is also restaurants/, accommodation/, entertainment/, etc.
So what would it be like for all pages?
^$ .html
would that work?

lucy24

4:33 am on Oct 4, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



No. Unless your object is to take all requests for the site's front page and send them to the 404 page.

What's inside all those newly created directories? One index page in each, so the former "/page" is now "/page/index.html" and there's nothing else in any of the directories?

How long ago did you do this? If it's recent, I'd say get rid of 'em. Physically, I mean. Change /page/index.html to /page.html for all pages and put them back in their original directories, if any. Rewrite as recommended above.

If it happened months ago and you're only now becoming aware of the problem, leave the physical files as they are and do the redirect-plus-rewrite shuffle:

RewriteCond %{THE_REQUEST} index\.html
RewriteRule ^(page|otherpage|thirdpage)/index\.html http://www.example.com/$1 [R=301,L]
AND
RewriteRule ^(page|otherpage|thirdpage)$ /$1/index.html [L]

Yes, you are redirecting to a nonexistent file and then rewriting back to what the user requested in the first place. Your exact situation is a little unusual but the basic principle shows up a lot. You'll find it in many threads in the Apache forum. (How on earth did this question end up in HTML?)

Which approach you take depends on how many links you've picked up to the new, unwanted URLs. You may or may not be able to turn back the clock. "It's OK, google, I had a spot of trouble but everything is back to normal now." This is one case where it's to your advantage that g### never forgets an URL, and will keep trying to crawl it until the cows come home.

g1smd

6:08 am on Oct 4, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



So what would it be like for all pages?

Are they all in the root?
^([^/.]+)$
and
/$1.html


In sub-folders?
^(([^/]+/)*[^/.]+)$
and
/$1.html