http://www.yoursite.com vs yoursite.com (no www)
I have a few questions about this, on my site all of the following are the same page:
http://www.yoursite.com
yoursite.com
yoursite.com/index.php
yoursite.com/index.php?page=1
Could this potentially mean that my PR could get divided by FOUR instead of TWO? and if so, can someone help me with an .htaccess file that will make everything direct to the http://www.yoursite.com ?
Best regards,
Bernie
can you clear this up for me. when I think of mod-rewrite I think of this thing some programmers did for me that turns pages like:
xwww.gamblingforum.com/forum/viewtopic.php?posid=32&SESSION=3243242
to something more readable like this
xwww.gamblingforum.com/forum/post2.html
this is not what I’m doing here…. I am actually trying to redirect to a new page that is completely different page. (not the same page rewritten)
do I still look where the link points me? ” title=”” class=”bbcode_smiley” /> — sorry, if I look at that for four hours and find out it doesn’t work, I’ll be sad … can you shed just a wee bit more light?
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.yoursite.com
RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]
OR simply add this line which tells anyone grabbing the other page it has moved permanently to the http://www.yoursite.com
redirect 301 yoursite.com http://www.yoursite.com
Still having trouble with this can someone give me an idiots example of how to redirect this file:
index.cfm?var_file=cripcdir.htm
to this file:
cripple.php
Thanks much in advance!
To remove dynamically generated pages, you’d use this robots.txt entry:
User-agent: Googlebot
Disallow: /*?
AS long as it is a permanent redirect – 301
AND you are NOT trying to link stuff by having the virtual links like this domain.com?page=2 domain.com?page=3 in your pages there should not be a looping problem for users or bots.
There are cleaner ways do do this at the server level but it depends on your server flavor and what you want to accomplish.
additional resources:
CAP Spring Break Notes
No that part I didn’t figure out yet… Was talking about redirecting:
Now I really have to figure out the other trick. I have php files that include .htm files…. both are ranking in the engines – but when the .htm files show up, there is no CSS style sheets,etc… applied because it is just pulling the guts of the page. How to make someone who calls thispage.htm, load thispage.php?
Thanks,
Bernie
Great! Did you end up using .htaccess to make index.php and index.php?page=1 redirect to xwww.yoursite.com?
I have done this and it works for redirecting.
Best regards,
Bernie
edited to remove stupid question
is it best to put a link on the PR6 page to pass the PR? or will another redirect through .htaccess accomplish the same thing seamlessly?
If you use .htaccess or a 301 Permanent Redirect, 100% of the PR should be transferred (and yes, it’s seamless). A 301 Permanent Redirect is quite easy to use — after you move the old page to the new URL, delete all of the code on the old page and replace it with this:
[HTML]
header(“HTTP/1.1 301 Moved Permanently”);
header(“Location: http://www.yoursite.com/newpage.php”);
exit();
?>[/HTML]Make sure there aren’t any spaces before the and after the ?>. Hold down the delete key to make sure there aren’t any hard returns or spaces, otherwise the redirect may not work right.
I don’t think you could use a 301 redirect on index.php or index.php?page=1, since these pages are the same as the home page of http://www.yoursite.com. I don’t know what would happen if you redirected a page to itself — I guess it would create an infinite loop.
I am not very familiar with .htaccess, but I do believe some kind of .htaccess code will end up being the solution here. I know it is possible to use .htaccess to rewrite URLs so that the “?” in the URL is replaced with a forward slash (some people do this for SEO reasons). You can also shorten dynamic URLs this way. Here is a page that might give you a few ideas.
Does anyone else have ideas on how to solve this problem?
Please login or Register to submit your answer