Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Moved permanently headers
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

bobby131313
Senior Member

USA
1163 Posts

Posted - 24 November 2007 :  20:30:19  Show Profile  Visit bobby131313's Homepage
OK, I just moved a bunch of files to a higher directory and I need to "move them permanently" I'm trying to do it so that I can grab the filename on the fly so I can put the same exact code in all the old files.....


<%@ Language=VBScript %>
<%
dim strFileName :strFileName = replace(mid(request.servervariables("script_name"),instrrev(request.servervariables("script_name"),"/")+1),".asp","")
%>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", ""http://www.coincommunity.com/coin_facts/half_cents/"" & strFileName & ""
%>


I've been playing with variations of this for about an hour. Am I even close?

Switch the order of your title tags

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 25 November 2007 :  06:35:52  Show Profile  Send ruirib a Yahoo! Message
This should do it

<%@ Language=VBScript %>
<%
dim strFileName
dim scriptname

scriptname = split(request.servervariables("SCRIPT_NAME"),"/")
strFileName = scriptname(ubound(scriptname))

Response.Status="301 Moved Permanently"
Response.AddHeader "Location", ""http://www.coincommunity.com/coin_facts/half_cents/"" & strFileName & ""
%>



Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

bobby131313
Senior Member

USA
1163 Posts

Posted - 25 November 2007 :  08:55:24  Show Profile  Visit bobby131313's Homepage
Thanks Rui.

With that, I'm getting this....

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/coin_facts/half_cents_notes/1793_liberty_cap_half_cent.asp, line 10

Response.AddHeader "Location", ""http://www.coincommunity.com/coin_facts/half_cents/"" & strFileName & ""
---------------------------------^


I don't feel so bad now.

Switch the order of your title tags
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 25 November 2007 :  10:24:52  Show Profile  Send ruirib a Yahoo! Message
Why don't you feel bad? I didn't even look at that one, it's all your doing . Looks like it has an extra pair of quotes:


Response.AddHeader "Location", "http://www.coincommunity.com/coin_facts/half_cents/" & strFileName




Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

bobby131313
Senior Member

USA
1163 Posts

Posted - 25 November 2007 :  10:35:20  Show Profile  Visit bobby131313's Homepage
Ha! That's it!

Thank you, saves some time.

Switch the order of your title tags
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07