Mobile app version of vmapp.org
Login or Join
Ogunnowo487

: Most efficient and SEO & Google Analyitics Friendly way to redirect I am looking for the most efficient way to redirect users to different web pages on my server using a keyword off of the

@Ogunnowo487

Posted in: #Apache #GoogleAnalytics #HttpdConf #Redirects #Seo

I am looking for the most efficient way to redirect users to different web pages on my server using a keyword off of the main domain.

So www.example.com/keyword might take you to a longer URL like www.example.com/arts-and-culture/articles/index.html
Currently I am using an Apache redirect in the http.conf file

Redirect /keyword www.example.com/arts-and-culture/articles/index.html
I am wondering if this is the best and most efficient way to accomplish a redirect. I also could do a redirect in the .htaccess file I believe and also do something like a PHP redirect like

header( 'Location: www.yoursite.com/new_page.html' ) ;


I just want the most efficient way of doing a redirect that is not harmful to SEO or tracking via Google Analytics.

Can anyone give me a heads up on what they are using and why?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Ogunnowo487

1 Comments

Sorted by latest first Latest Oldest Best

 

@Kevin317

If the pages have already been published you'll want to use a 301 redirect as that will transfer all links and their SEO benefit from the old URL to the new URL (FYI, a small amount of of PageRank and link value is lost).

This can be in the http.conf file, .htaccess, or PHP.

http.conf/.htaccess example

redirect 301 /old_page.html www.yoursite.com/new_page.html

PHP example:

header( 'Location: www.yoursite.com/new_page.html', true, 301 ) ;


By doing this on the server side you won't trigger Google Analytics to track the old URL. However, if you do want to use Google Analytics to track those redirects you will need to use client side redirects.

JavaScript example:

<script type="text/javascript">
<!--
// This goes after the GA code
window.location = "http://www.yoursite.com/new_page.html";
//-->
</script>


Or with a 5 second delay (this can go before or after the GA code)

<html>
<head>
<script type="text/javascript">
<!--
function delayer(){
window.location = "http://www.yoursite.com/new_page.html";
}
//-->
</script>
</head>
<body onLoad="setTimeout('delayer()', 5000)">
<h2>Prepare to be redirected!</h2>
<p>This page is a time delay redirect, please update your bookmarks to our new
location!</p>

</body>
</html>


META Tag example

<!-- content="5" will redirect the page in 5 seconds-->
<meta http-equiv="refresh" content="5">


HTTP header example:

(The 5 is the number of secods to wait to redirect
Refresh: 5; url=http://http://www.yoursite.com/new_page.html/


If those pages have not be published you can use mod_rewrite to make the URLs more user-friendly:

RewriteEngine on
RewriteRule ^([^/.]+)?$ example.com/long-url/article//index.html [L]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme