SEO friendly URLs with Delphi ISAPI - delphi

My customer wants me to get rid of the dll and ? & characters in the url and use SEO friendly urls.
How can I go about this URL - rewrite?
Currently I have something like:
http://www.ultimateholidayplanner.com/uhp.dll/AccList?PN=AccommodationSearch.htm
That needs to turn into something like:
http://www.ultimateholidayplanner.com/Accommodation/List.htm
Many thanks

Use II7 and download Microsoft URL rewrite module to change this behavior.
see Using URL Rewrite module
Regards

You don't need to change your code, you need just to use something like ISAPI_Rewrite

ISAPI extensions can be mapped to the extension ".*" creating a wildcard extension mapping, and so catching any and every request to the site/virtual-dir. (especially with 'check that file exists' unselected)
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/5c5ae5e0-f4f9-44b0-a743-f4c3a5ff68ec.mspx?mfr=true
(if it might interest you: I found out working on xxm)

Related

Umbraco URL issue with Vorto

I am using vorto plugin in my Umbraco 7 application to achieve the multilingual capability.
I mentioned the URL in hostname as 'localhost/clientname/en'.
Whenever I open login page the URL which is getting form is 'http://localhost/clientname/en/login'.
This is the structure of vorto URL writing.
But can I achieve it like 'http://localhost/clientname/login/en' ???
I want language names at the end of the URL, not in between.
Is it possible ?
Please help....i am badly stuck in my project task !
It sounds like you need a custom URL provider, setting the domain to 'localhost/clientname/en' will mean that the URLs will always get added AFTER the language part as the host is always the first part of the URL.
Have a look at this article on URL providers and content finders: https://24days.in/umbraco-cms/2014/urlprovider-and-contentfinder/ it's quite old, but it should still work. That should give you an idea of how to make it work. Basically you want the URL provider to append the language to the end of the URL, and the content finder to strip the language from the end and then find the actual content. You can also then set the language of the current thread in the content finder so that Vorto and Umbraco are using the correct language based on the URL.

ASP Classic - How to set up Permalinks. URL rewrite?

We have a web project which we are working on (Custom CMS). Have a url example http://www.test.com/page.asp?PID=191
Is there not an way to change this url into something like http://www.test.com/product-title/
Any help would greatly be appreciated.
An old method of doing this was to use custom error handling. Using a 404 custom error handling page you can trap a request to http://www.test.com/product-title/ pull it apart and build the request to the resource in this case http://www.test.com/page.asp?PID=191.
There are various ways of doing this from storing the values in a database so you can lookup your friendly address against it's equivalent to using the URL to describe the resource, something like http://www.test.com/products/191/ then using this as the basis of your rewrite.
In newer versions of IIS though (7 and above) you can use the URL Rewriting to build translation from one URL to another on the fly.
Links
URL Rewrite (download link)
Using the URL Rewrite Module

iis 7 url rewrite with preset paths

I'm trying to make something like this work in iis 7, or web config
request:
products.aspx?id=100
rewrite:
domain/products/mp3
Please note, I do not want redirection, for domain/products/mp3 is invalid path, I just want the url rewrite so the user sees this path but the server serves the actual request.
Can you help?
Can you use the URL Rewrite functionality from ASP.NET instead? That was built for that.
RouteTable.Routes.MapPageRoute("Test", "domain/products/{type}", "~/products.aspx");
Then in products.aspx you have to map from mp3 to 100 somehow, but I assume you have a db table for that anyway.

Possible to have ampersands ("&") in URL BEFORE the query string?

My client is determined to have a page at /nfm&t so I made a directory named nfm&t with an index.html (to test) and that URL is still throwing a 404. So apparently it's not that easy.
Any ideas? Or is there a way to just redirect nfm&t to nfmt, so that the URL at least resolves?
This is a Windows server, by the way, which throws a wrench into how I'm used to doing redirects.
Turning on AllowRestrictedChars and enabling VersionCompatibility should do it.
Why would a Windows Server throw a wrench into how you do redirects? If you are using IIS 7, you can use URL Rewrite Module. It is built into IIS. If you are using IIS 6, there is ISAPI Rewrite, which is an external module. Both use the same syntax as mod_rewrite for Apache.
Do you have a /nfm directory? If you don't, try making one. Either way, put in a Default.aspx file and have it spit back at you the exact path it's trying to access. Chances are, when you have this here, it will go to example.com/nfm/Default.aspx and let you run something from there.
If you do get to that directory, then try redirection to example.com/nfm%26t and see if it works. If this still doesn't help it, then you're SOL
I tried this on my Snow Leopard ( OSX 10.6.2 ) workstation with Apache and it works. That is from Firefox 3.6. Looks like a Windows thing you are struggling with. Honestly I didn't think that would work without encoding but you never know until you try.
alt text http://www.vertigrated.com/images/so_screenshot.png
Or is there a way to just redirect
nfm&t to nfmt, so that the URL at
least resolves?
Sure. Make a general url handler and/or an error handler. When it encounters a url, if that url is equal to /nfm&t, then under the hood rewrite the context to whatever page you actually really want to return. Is this a good idea? Probably not. But it will work. Keith's answer suggests two ways to grab the url and do stuff, though you could also do this via a global asax file (being careful to execute an aspx page when you hit an error so it actually gets hit) if you're using .Net.

What is a website that ends with a .sd extension?

I know there are:
.aspx
.php
.html
.htm
This is the first time I'm seeing a website with .sd at the end. What exactly does that mean and is there a wiki that explains a bit more?
For example, this website:
http://www.racingpost.com/horses2/results/home.sd
First time I'm seeing it and I'm just curious.
Because the choice of extension is practically meaningless on the web - the content-type header defines the actual format of the content - there are lots of exotic extensions around, mostly defined by the CMS or framework used. I'm pretty sure this is not an "own format" in the sense that "html", "aspx" and "php" differ from each other internally by containing raw HTML, PHP code, or ASP code, but just a "vanity extension" if you will.
Can you show us the web site in question? Maybe somebody can hazard a guess what CMS/platform it was built with.
Edited for the url you added: that specific one is most likely being used with the BlueDragon system, a family of runtime server-side products for the deployment of CFML pages, deployed in possibly a j2ee environment.
for instance you can google the site for references:
http://www.google.com/search?q=site%3Anewatlanta.com+%22sd
or see a servlet debug page:
http://74.125.93.132/search?q=cache:yg7UIh6nRdIJ:www.lucasoil.com/landing_pages/14,3.html/+%22index.sd%22+bluedragon&cd=2&hl=en&ct=clnk&gl=us&client=firefox-a
or you may be referring to the TLD (top-level domain name).
the TLD .sd belongs to country of Sudan which is managed by the Sudan Internet Society:
http://www.isoc.sd/sudanic.isoc.sd/
.sd could be anything. According to Fileinfo.com it is the default extension for some type of audio file.
However, I could make a php page called index.sd and as long as I have my webserver configured in the correct way, it would serve it up as php. That goes for other things as well, .html, .py, .pl... etc, etc.
I would just need to add this to my configuration file for apache:
AddType application/x-httpd-php .sd
According to fileinfo .sd is an audio file.
The Top Level Domain .sd denotes Sudan.
Other than that, you can come up with any extension you want (or even use an existing one) and point it to any handler you want, say, in your web server, or in your code. (In the .NET world, you can define your own MIME types through IIS, or setup Http Handlers in your web.config)
Good old "view source" shows that it is just HTML.
At a guess, it's probably one of the above - it's pretty trivial to get a webserver to arbitrarily treat a file as whatever you want irrespective of its extension.
.sd is for SUDAN
like .in for India
.us for USA

Resources