How can I shorten the url a user has to type?
July 19, 2009 4:11 AM Subscribe
Can I program something so a visitor who wants to see www.example.com/CTTourHome.htm only has to type www.example.com/ct ?
I will be putting a link to this page on the homepage of my site, but I want to put something easy to type on offline ads and announcements.
I remember doing something like this with an old website I had on a different host. I think it was doteasy.com and now I'm on lunarpages.com. (I asked lunarpages and they said I couldn't do this. Hmmm... how did I do it before then?)
Is it possible to let users type in that trailing "/ct" without including a .htm extension?
This is a new subsection of the site by the way, but I haven't made a new subdirectory for it. Do I need to do that and make my desired page the default, index page for the subdirectory?
One last thing: this is an add-on domain, so it's a subdomain or folder under my main domain. I am able to access it via ftp directly with the dreamridersmovie.com address.
I will be putting a link to this page on the homepage of my site, but I want to put something easy to type on offline ads and announcements.
I remember doing something like this with an old website I had on a different host. I think it was doteasy.com and now I'm on lunarpages.com. (I asked lunarpages and they said I couldn't do this. Hmmm... how did I do it before then?)
Is it possible to let users type in that trailing "/ct" without including a .htm extension?
This is a new subsection of the site by the way, but I haven't made a new subdirectory for it. Do I need to do that and make my desired page the default, index page for the subdirectory?
One last thing: this is an add-on domain, so it's a subdomain or folder under my main domain. I am able to access it via ftp directly with the dreamridersmovie.com address.
If you are using Apache and it has mod_rewrite installed you could create an .htaccess file at root folder with the following content:
RewriteEngine On
RewriteBase /
RewriteRule ^/ct$ /CTTourHome.htm [L]
Some Apache configurations may require including "Options AllowSymLinks" just before "RewriteEngine On".
That should do the trick. You can learn more about mod_rewrite here.
posted by Guywood Threepbrush at 4:52 AM on July 19, 2009
RewriteEngine On
RewriteBase /
RewriteRule ^/ct$ /CTTourHome.htm [L]
Some Apache configurations may require including "Options AllowSymLinks" just before "RewriteEngine On".
That should do the trick. You can learn more about mod_rewrite here.
posted by Guywood Threepbrush at 4:52 AM on July 19, 2009
It looks like lunarpages.com offers mod_rewrite support. Go nuts.
posted by paulsc at 4:57 AM on July 19, 2009
posted by paulsc at 4:57 AM on July 19, 2009
Response by poster: Creating the new directory worked perfectly and I didn't have to go learn the mod-rewrite. (I know, I know... I should learn it, but I'm in a real hurry and doing a new directory worked great.) Thanks for all the help.
posted by DreamRider at 6:30 AM on July 19, 2009
posted by DreamRider at 6:30 AM on July 19, 2009
[late] If your webhost has cPanel installed, you can also do this easily though cPanel's "redirect" function without having to do any programming (and without learning mod_rewrite!). [/late]
posted by richardhay at 7:58 AM on July 19, 2009
posted by richardhay at 7:58 AM on July 19, 2009
This thread is closed to new comments.
However, that index.html has a redirect directive that shunts the users to the real webpage.
So, you type in the short URL, the browser/httpd give you the index.html, and the redirect moves users to the real page.
posted by Netzapper at 4:37 AM on July 19, 2009 [1 favorite]