Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 343
  • Last Modified:

Url rewrite - replacing characters

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
Witheet
Asked:
Witheet
  • 2
1 Solution
 
nkoriginalCommented:
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
 
nkoriginalCommented:
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
 
WitheetAuthor Commented:
Thanx for the post... I'll post back asap with results...
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now