Thanks for the reply. I've seen WordPress and Joomla do this before. But we don't use a CMS. It's a custom PHP framework. Although in my research I read that WP does a rewrite but not a 301 redirect. Not sure. WP has so many plugins so maybe there is one for redirecting changed file names. I'm sure between htaccess and a DB table we can do it. We'll definitely give it a try. I was just hoping to find an example of this online that I could view first.
- Home
- bimmer540
Moz Q&A is closed.
After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.
Latest posts made by bimmer540
-
RE: A script to automatically write 301 redirect rules to htaccess?
-
A script to automatically write 301 redirect rules to htaccess?
I was wondering if anyone could help provide some resources on how to automatically write 301 redirect rules to htaccess. Allow me to explain...
I'm building a new website and the primary users are businesses. They have their own profile pages on the site.
The URL is based off of their Company Name.
In the event that they decided to change their name... reasons being, perhaps they mispelled it the first time, or they're removing LLC or adding Inc, I want to also change the URL and redirect the old URL to the new URL.
Since the URL is based off of their Company Name, making a change to the company name would make a change to the URL. I know it doesn't have to work this way, but for our purpose this works best.
In case the old URL had any links to it, I wanted to see if there was an way to automatically update an htaccess file with a 301 redirect from the old URL to the new one.
Could anyone point me in the right direction of how to do this? Perhaps a sample script. I've done a lot of searches on Google and can't seem to find anything.
e.g.
Original:
Name: XYZ Widgets
URL: website.com/xyz-widgetsNew - business changes their company name in their profile:
Name: XYZ Widgets, Inc.
URL: website.com/xyz-widgets-incUpon the user saving the changes in their profile, I'd like to write a 301 redirect to an htaccess file:
Redirect 301 /xyz-widgets http://www.website.com/xyz-widgets-incI know how to manually write redirects and I've got a pretty smart web developer. We've just never triggered a script to automatically write to an htaccess file before.
Is this possible? Any resources are appreciated. Any security risks?
Thanks!
-
RE: Do social signals pass through a 301 redirect?
I recently 301 redirected an old domain to a new domain...
Facebook:
Unfortunately, Facebook Likes don't pass through. I have read a few articles that recommend editing the meta property og:url to the old URL, as well as changing the data_href on the Like button to the old URL. But I haven't seen it work, and the Facebook Object Debugger throws an error.Google+
The +1's from the old domain did transfer to my new domain. I can tell that the +1 counter didn't start from 0 again, plus, since I +1'd a couple of my own pages last year on the old domain, I can see those +1's in my Google+ profile. It shows me that I did indeed +1 pages on the old domain last year, and if I go to those pages on the new domain now, the +1 button is red and lets me know that I publicly +1 it. It looks like those transfer just fine.So Google+ share counts seem to transfer, but not FB Likes. Is there a way that Google can know a page on the old domain has a lot of FB likes, and even though the count doesn't transfer to the new domain, they use the old domain social signal and pass its authority to the new domain? The more I think about it, probably.
My old domain had importance, and soon after the 301 my new domain seemed to reap a lot of the old domains value. Even if Google can't pull up my old FB Like count in the same way that I can't, there's probably still a social signal value that Google has stored.
So the more I think about this, even though my FB Like Count for a specific page went from 2000 Likes on the old URL to 0 Likes on the new URL, I think Google still passed that authority to the new URL. I don't have hard facts, just what I've observed. I do wish I could get my old Like Counts back though.
-
RE: Analyzing word count on page SEO
Personally, I never really analyze keyword density. If you try to write/design a page around what users want, with good content, you should be fine.
You should always have your target keyword in your tags, and in your example, your target keyword only appearing twice out of a thousand words doesn't seem like a lot at all. I think naturally writing an article without SEO in mind you'd come up with that anyway.
I know some people really keep an eye on keyword density, and I'm sure they have a ratio they like to stay under, but I try to just be reasonable and write for users (with search engines in mind of course).
One thing about keyword stuffing that I'll say is only put the keyword in an image alt tag if it actually describes the image. Don't just do it to get another instance of the keyword on the page.
Best posts made by bimmer540
-
RE: Analyzing word count on page SEO
Personally, I never really analyze keyword density. If you try to write/design a page around what users want, with good content, you should be fine.
You should always have your target keyword in your tags, and in your example, your target keyword only appearing twice out of a thousand words doesn't seem like a lot at all. I think naturally writing an article without SEO in mind you'd come up with that anyway.
I know some people really keep an eye on keyword density, and I'm sure they have a ratio they like to stay under, but I try to just be reasonable and write for users (with search engines in mind of course).
One thing about keyword stuffing that I'll say is only put the keyword in an image alt tag if it actually describes the image. Don't just do it to get another instance of the keyword on the page.
-
RE: Do social signals pass through a 301 redirect?
I recently 301 redirected an old domain to a new domain...
Facebook:
Unfortunately, Facebook Likes don't pass through. I have read a few articles that recommend editing the meta property og:url to the old URL, as well as changing the data_href on the Like button to the old URL. But I haven't seen it work, and the Facebook Object Debugger throws an error.Google+
The +1's from the old domain did transfer to my new domain. I can tell that the +1 counter didn't start from 0 again, plus, since I +1'd a couple of my own pages last year on the old domain, I can see those +1's in my Google+ profile. It shows me that I did indeed +1 pages on the old domain last year, and if I go to those pages on the new domain now, the +1 button is red and lets me know that I publicly +1 it. It looks like those transfer just fine.So Google+ share counts seem to transfer, but not FB Likes. Is there a way that Google can know a page on the old domain has a lot of FB likes, and even though the count doesn't transfer to the new domain, they use the old domain social signal and pass its authority to the new domain? The more I think about it, probably.
My old domain had importance, and soon after the 301 my new domain seemed to reap a lot of the old domains value. Even if Google can't pull up my old FB Like count in the same way that I can't, there's probably still a social signal value that Google has stored.
So the more I think about this, even though my FB Like Count for a specific page went from 2000 Likes on the old URL to 0 Likes on the new URL, I think Google still passed that authority to the new URL. I don't have hard facts, just what I've observed. I do wish I could get my old Like Counts back though.
Passionate about internet marketing since 2005. Experienced in SEO, conversion rate improvement, usability, and email marketing.
Looks like your connection to Moz was lost, please wait while we try to reconnect.