Solved

Url rewrite - replacing characters

Posted on 2008-11-03
3
330 Views
Last Modified: 2012-06-21
Hello all,

I know close to nothing about rewrite so what i have is copied from other solutions and works great but i need more... Namely:
Right now I use attached code to make links look like
result_article.asp~A_Id~Title_Of_Article~A_Id2~31~A_Id3~33
Instead of :
result_article.asp?A_Id=Title_Of_Article&A_Id2=31&A_Id3=33

What I need it to be is something more like:
result_article_Title_Of_Article.htm
OR
result_article~Title_Of_Article.htm
If possible at all...

strings can sometimes have 4 paramters!
Up to A_Id4= (there's only 1 with text other 3 will always be numeric... the one with text is more show then function

If not possible... anything making it look more like a static filename where the parameter after A_Id1= Title_Of_article - has a big role...

Is there an easy page on the web where i can find out more on how to get this done or suggestions... Remember plz MEGANOOOOBB!!!!!

Thanks for any suggestions!
WKR
Bobby V
[ISAPI_Rewrite]
RewriteRule (.*?\.asp)(\?[^~]*)?~([^~]*)~([^~]*)(.*) $1(?2$2&:\?)$3=$4$5 [NS,I]
 
RewriteRule   ^(.*)\s(.*)$      $1_$2 [N]

Open in new window

0
Comment
Question by:Witheet
  • 2
3 Comments
 
LVL 5

Expert Comment

by:nkoriginal
ID: 22896580
hello, check my example in ASP

It has the solution for your problem
<%
URL = "result_article.asp~A_Id~Title_Of_Article~A_Id2~31~A_Id3~33"
 
if left(URL,19) = "result_article.asp~" then
	URL1 = Replace(left(URL,19),"~","=")
	response.Write(URL1)
	
	URL2 = MID(URL,20,200)
	URL2Total = Replace(URL2,"~","_")
	
	response.Write(URL2Total)
	
end if
%>

Open in new window

0
 
LVL 5

Accepted Solution

by:
nkoriginal earned 500 total points
ID: 22896612
Sorry, check this

I just put one variable to show the entire URL after the automatically modification

The variable name is URL_NEW. this variable it will show you the new URL with the = and _ oir whatever you want
<%
URL = "result_article.asp~A_Id~Title_Of_Article~A_Id2~31~A_Id3~33"
 
if left(URL,19) = "result_article.asp~" then
	URL1 = Replace(left(URL,19),"~","=")
	'response.Write(URL1)
	
	URL2 = MID(URL,20,200)
	URL2Total = Replace(URL2,"~","_")
	'response.Write(URL2Total)
	
	URL_NEW = URL1 & URL2Total
	
	response.Write(URL_NEW)
	
end if
%>

Open in new window

0
 

Author Comment

by:Witheet
ID: 22897655
Thanx for the post... I'll post back asap with results...
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question