Skip to content

Javascript window.location seen as 301 by SEs?

DeeeeeeeeDeeeeeeee the Americas
edited December 2020 in Other / Off Topic
Which of these is best? Do any/all break the "link juice" flow? Do these count as 301s?
window.location = "htt p://website.com";
window.location.href = "htt p://website.com";
window.location.assign("htt p://website.com");
window.location.replace("htt p://website.com");<br>
((Maybe I should redirect with .htaccess instead if JavaaScript is not a surefire way of transmitting link weight? It's just that I am not sure how to go about this using apache...
As I have it, PHP logic tests for the COMPLETE URL in PHP, after apache makes all requests appended to index file:
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
A test fot exact URLs go first in the PHP code, and then, if no flag is set for "exact page" AND then there's a positive test for  a partial match, it then redirects. It now works, but  is this OK for SEO?))

I at first tried doing the redirect on partial match in PHP, but didn't work. Not sure why. Maybe headers already sent? Have error logging not echo'ed to screen and didn't check. That's why I am using JS. Just waiting to see what you guys think before I waste more time doing this and then having to re-do.
What about META refresh in HTML? Does that transmit link power?

Comments

  • DeeeeeeeeDeeeeeeee the Americas
    edited December 2020
    OK. Now just moving everything over. In the process I'll eliminate tons of files. Now just one data file for each page. I guess I cld have put them all in one file, but I feel this is neater. Metas are dynamically generated, and content is pulled from these other per-page data files.
    Is there a way to get SER to create random URLs to post backlinks to?
    The way  the new site config is set up, as long as the URL has at least a keyword in it, browser will redirect, tho still using JS. (dunno about that part, I will  probly re-do it so it's using PHP, unless I find out that JS is OK)
    Example: htt p://site.com/machines-from-the-1970s (actual URL)
                   htt p://site.com/1970s (nonexistent URL will 301 to actual)
                   htt p://site.com/cool-machines-from-the-1970s (nonexistent URL will 301 to actual)
    Is there anything NOT good about doing this with backlinks? I can backlink without actually having any links going directly to the page itself now.
    Thanks...




  • SvenSven www.GSA-Online.de
    A 301 redirect is the best you can do. However, not sure if that will be a good idea SEO wise to accept almost any URL.
    But then again, who would link to that page anyway with some random strings in URL.And you use the canonical-tags anyway.
    Thanked by 1Deeeeeeee
  • DeeeeeeeeDeeeeeeee the Americas
    Just experimenting. At the very least, I'm having fun with this all again. lol :p
Sign In or Register to comment.