Reply
301 redirect for *.asp files
Old 04-09-2008, 07:37 AM 301 redirect for *.asp files
Experienced Talker

Posts: 33
Hi

I have just moved a very large ASP coded online shop into a new php online shop.

I have directed the .asp main categories to the proper .php file using 301 redirects.

Is there a quick way I can 301 re-direct all other (*.asp) files to say my all_products.php page?

Cheers

p9
69me is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 04-09-2008, 02:15 PM Re: 301 redirect for *.asp files
chrishirst's Avatar
Super Moderator

Posts: 12,808
Location: Blackpool. UK
Code:
<%
response.status = "301 Moved Permanently"
response.addheader "Location","http://new_uri"
response.end
%>
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-09-2008, 03:52 PM Re: 301 redirect for *.asp files
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,024
Name: Forrest Croce
Location: Seattle, WA
Are you changing all the page and folder names? If they'll be the same, you might consider an internal redirect, so the url doesn't change as far as the outside world is concerned, but the server parses asp files as if they were php?
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 04-09-2008, 09:31 PM Re: 301 redirect for *.asp files
nyef's Avatar
Extreme Talker

Posts: 230
Name: Lucas
Code:
<%
if lcase(right(request.servervariables("SCRIPT_NAME"),4))=".asp" then
  response.redirect "/all_products.php"
end if
%>
nyef is offline
Reply With Quote
View Public Profile Visit nyef's homepage!
 
Old 04-10-2008, 04:09 AM Re: 301 redirect for *.asp files
Experienced Talker

Posts: 33
sorry...im on a linux server now so cannot process asp code as suggested above.

It's really a 301 / htaccess solution I'm looking for if possible...

cheers

p9
69me is offline
Reply With Quote
View Public Profile
 
Old 04-10-2008, 05:32 AM Re: 301 redirect for *.asp files
chrishirst's Avatar
Super Moderator

Posts: 12,808
Location: Blackpool. UK
Quote:
sorry...im on a linux server now so cannot process asp code as suggested above.
It's always handy to know these things

@nyef;
Using response.redirect in ASP sends a 302 response to the user agent not a 301.

Apache & .htaccess is not my forte but;

Code:
RedirectMatch 301 *.asp http://www.example.com/pagename.php
should work I think.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to 301 redirect for *.asp files
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14239 seconds with 13 queries