SEO Class in Chicago, IL
Learn How To Optimize Your Website on July 26, 2013
High Rankings is offering a 1-day customized SEO training class in Chicago. Class size is limited so please sign-up now if you want in!
Are you a Google Analytics enthusiast?
Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE!

www.CustomReportSharing.com
From the folks who brought you High Rankings!
More SEO Content
Redirect From .asp To .php
#1
Posted 12 August 2009 - 09:09 AM
I have no idea how to script the such redirects and I've had a look at some of the codes on this site but I'm a bit lost. Also, very concerned as I want any loss in placement to be temporary.
I would also like to know the deal with redirecting dynamic pages. For example, I have a news app with urls such as www.mywebsite.com/news/news_item.asp?NewsID=169
Can I do this redirect?
Would also it be possible to redirect any news item in the old site to the new default news page in the news site?
I'm looking for some pointers with the coding. Please help, thanks.
#2
Posted 12 August 2009 - 09:50 AM
If so, you can use a more mass type of redirect that pegs to the extension. If not, you'll need to set up individual page redirects. So it's an important question to answer.
If paths and file names remained consistent so you can do a mass redirect of all .asp pages to their .php equivalent it would look like:
RewriteCond %{REQUEST_URI} ^/(.*)\.asp
RewriteRule ^(.*)\.asp$ http://www.yoursite.com/$1.php [R=301,L]
That's just one way to do it btw. There are several.
Dunno what you want to do with redirecting the news pages exactly. Were you wanting to simply redirect any traffic to /news/news_item.asp to a main news page? If so, that one will be a piece of cake. It would look something like:
Note that question mark (?) at the end of the new php news page. That's there to strip off queries that may have been present from the original request so that they end up at your main new landing page.
#3
Posted 12 August 2009 - 11:00 AM
Regarding the newspages, that is more or less what I want to do, I don't want to try redirecting individual news items. So thanks for that!
The names and paths of the pages change. In the last structure most of the main pages were in the root, www.mywebsite.com/bookhotel.asp
In the new structure, it's been organised to look like www.mywebsite.com/services/bookhotel.html
(they are .html page spawned from an SEF component)
#4
Posted 12 August 2009 - 12:57 PM
For the rest you'll need to do individual page redirects. Again there are several ways to do it. If it were me I'd use RedirectMatch since that'll be slightly easier on the server's load. You'll need one line for each page you're redirecting, but there will be less overall cpu usage by Utilizing RedirectMatch as opposed to using mod_rewrite. So the single line for your bookhotel example would look something like:
(Make sure you escape the dots just before the extension in the first part of the statement with a backslash character.)
#5
Posted 12 August 2009 - 02:59 PM
Much appreciated!
#6
Posted 11 September 2009 - 02:03 PM
#7
Posted 11 September 2009 - 05:00 PM
First you could try simply replacing the tilde characters with its encoded equivalent, which I believe is %7E. Or you could try escaping the tilde characters by preceding it with a backslash character. If my guess is correct that the tilde is being encoded before being sent, the first of the above will probably do the trick.
You could also convert all of them from the mod_alias approach of using RedirectMatch to the mod_rewrite approach of using RewriteRule. mod_rewrite would allow you to use a catchall to get around the tilde character and match against everything else.
As an aside, is there a reason you're redirecting some to an IP number instead of a domain name? You do realize this can cause some confusion for the search engines if you're actively telling them to index some or all of the site via the ip address right? I wouldn't do it that way personally. I'd get the files uploaded to a domain name and deliver 'em from there.
#8
Posted 11 September 2009 - 07:09 PM
I'm guessing the redirect script can be located anywhere in the .htaccess file right? And that's not too many redirects..
#9
Posted 14 September 2009 - 06:14 AM
Thanks..
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users










