Domain Forwarding

  • StevCarls
  • Novice
  • Novice
  • User avatar
  • Posts: 27

Post 3+ Months Ago

Okay. I'm working on a page in a website that has a really long URL. What is the easiest way to make it so someone can enter a short URL and have the browser load a different page.

for example:

www .domainname.com/mnop

will load the page:

www .domainname.com/abcd/efgh/ijkl/mnop.html

or something like that...
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • harryhood
  • Graduate
  • Graduate
  • harryhood
  • Posts: 141

Post 3+ Months Ago

You could enter a redirect into your .htaccess file. Something like:

Code: [ Select ]
Redirect /mnop http://www .domainname.com/abcd/efgh/ijkl/mnop.html
  • StevCarls
  • Novice
  • Novice
  • User avatar
  • Posts: 27

Post 3+ Months Ago

harryhood wrote:
You could enter a redirect into your .htaccess file. Something like:

Code: [ Select ]
Redirect /mnop http://www .domainname.com/abcd/efgh/ijkl/mnop.html


I don't know what a .htaccess file is...
  • theak
  • Proficient
  • Proficient
  • User avatar
  • Posts: 438
  • Loc: Taipei, Taiwan

Post 3+ Months Ago

Try an internet search on htaccess. It is well worth learning to edit this file it opens a whole new range of features, provided your using an Apache server!

Below are some links to get you started, it's all pretty straight forward you just make a file in a text editor and save it as .htaccess

http://www.javascriptkit.com/howto/htaccess.shtml
[url]httpd.apache.org/docs/howto/htaccess.html[/url]
http://www.freewebmasterhelp.com/tutorials/htaccess/
  • StevCarls
  • Novice
  • Novice
  • User avatar
  • Posts: 27

Post 3+ Months Ago

I started reading about the .htaccess file but it says it doesn't work well with FrontPage extensions. There's another person that works on the site and I think he uses FP so I don't think I will use that method, but thanks for the info...

Any more suggestions?
  • harryhood
  • Graduate
  • Graduate
  • harryhood
  • Posts: 141

Post 3+ Months Ago

You could place the following code on the initial landing page. This would redirect anyone viewing that page to the longer url page after 15 seconds.

Code: [ Select ]
<meta http-equiv="Refresh" content="15;URL=http://www.domainname.com/abcd/efgh/ijkl/mnop.html">
  • StevCarls
  • Novice
  • Novice
  • User avatar
  • Posts: 27

Post 3+ Months Ago

harryhood wrote:
You could place the following code on the initial landing page. This would redirect anyone viewing that page to the longer url page after 15 seconds.

Code: [ Select ]
<meta http-equiv="Refresh" content="15;URL=http://www.domainname.com/abcd/efgh/ijkl/mnop.html">


This is just regular html, right? I'm not sure where this would go [in the header, maybe?] I guess I would also need an actual page in the root directory to start with before the forwarding instead of just an address, right?
  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

If you're running Apache web server, you can use AliasMatch, just put the following into your httpd.conf file and restart:
Code: [ Select ]
AliasMatch ^/somefolder/?(/.*)?$ "/server/path/to/somefolder/$1"

This will alias "http://www.yourdomain.com/somefolder" to whatever directory you point it to on your server
or
Code: [ Select ]
AliasMatch ^/page1.html"/server/path/to/page2.html"

This will cause the server to serve page2 from anywhere on your server whenever someone types in "http://www.yourdomain.com/page1.html"

This won't break anything, you can store whatever you want to serve anywhere on your server (even outside of your document root) and you can take out the AliasMatch lines whenever you don't need it anymore. I tend to use this method more than the .htaccess method because it gives me one place to make the changes in, instead of various files throughout the site.

Of course, if you don't have access to the servers httpd.conf file, this option isn't available to you.

hth
This
  • harryhood
  • Graduate
  • Graduate
  • harryhood
  • Posts: 141

Post 3+ Months Ago

StevCarls wrote:
harryhood wrote:
You could place the following code on the initial landing page. This would redirect anyone viewing that page to the longer url page after 15 seconds.

Code: [ Select ]
<meta http-equiv="Refresh" content="15;URL=http://www.domainname.com/abcd/efgh/ijkl/mnop.html">


This is just regular html, right? I'm not sure where this would go [in the header, maybe?] I guess I would also need an actual page in the root directory to start with before the forwarding instead of just an address, right?


This would go between the <body> tags. Right you would need to have this code in a page in your root dir. If you made it you index page then it would be accessable by http://www.yourdomain.com or http://www.yourdomain.com/index.html.
  • UNFLUX
  • Genius
  • Genius
  • User avatar
  • Posts: 6376
  • Loc: twitter.com/unflux

Post 3+ Months Ago

the easiest way to do this is to use a meta-refresh.

this goes between the head tags:
Code: [ Select ]
<META HTTP-EQUIV="refresh" CONTENT="5; url=http://www.domain.com/directory/page.html">

you can change the 5 to any number you like, it's a timer in seconds of
how long you want to wait. if you set it to 0, it redirects instantly.

obviosuly, change the URL to the page you want it to end up.
  • harryhood
  • Graduate
  • Graduate
  • harryhood
  • Posts: 141

Post 3+ Months Ago

UNFLUX wrote:
the easiest way to do this is to use a meta-refresh.

this goes between the head tags:
Code: [ Select ]
<META HTTP-EQUIV="refresh" CONTENT="5; url=http://www.domain.com/directory/page.html">

you can change the 5 to any number you like, it's a timer in seconds of
how long you want to wait. if you set it to 0, it redirects instantly.

obviosuly, change the URL to the page you want it to end up.


Like I said ^
  • UNFLUX
  • Genius
  • Genius
  • User avatar
  • Posts: 6376
  • Loc: twitter.com/unflux

Post 3+ Months Ago

well, it doesn't go in the body tags, and it doesn't have to be in the root either. it will work on any page, anywhere on the site.
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Posts: 1098

Post 3+ Months Ago

The way unflux described it above is correct, any page, between the head tags. ALL meta tags go there.

Anyway, that requires the browser to tell the server what page to serve it... in other words it doubles the traffic (and will throw off your web stats if you pay any attention to them, since it will count as TWO page views and not one).

It would be better to use a server-side redirect, .htaccess if you can, but if you're using PHP, use:

PHP Code: [ Select ]
<? header("location: PATH_TO_NEW_PAGE"); ?>


Put that on the first line of the entry page.

If you are using ASP:

Code: [ Select ]
<% Response.Redirect("PATH_TO_NEW_PAGE") %>


These paths can be fully qualified URLs (http://www.domain.com/dir/subdir/file.html) or they can be relative (../dir/subdir/file.html)

If you can't use PHP or ASP (or another SS language), and you can't do .htaccess because of the FP extensions, then your only option, I guess, is to use the meta tag method.

.c
  • harryhood
  • Graduate
  • Graduate
  • harryhood
  • Posts: 141

Post 3+ Months Ago

UNFLUX wrote:
well, it doesn't go in the body tags, and it doesn't have to be in the root either. it will work on any page, anywhere on the site.


Right it doesn't have to go in the root directory, I only said the root dir because stevcarls had mentioned the root directory in his question. I should have clarified that it would work from any directory, I was just trying to keep things as simple as possible.

Regarding where on the page it goes I'm sure you are correct that should go between the header tags. But it will work within the body tags, which is where it happened to be on an example page that I was looking at when I made my original post.
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Posts: 1098

Post 3+ Months Ago

harryhood wrote:
Regarding where on the page it goes I'm sure you are correct that should go between the header tags. But it will work within the body tags, which is where it happened to be on an example page that I was looking at when I made my original post.


Understandable, and I'm sure it would work anyway, at least in IE, if not other browsers. However, sometimes simply because it works doesn't mean it's the right way to do it...

Meta data is header information that is supposed to go back to the client (browser) first, before any other content is rendered. Thinks like keywords, content type, author, copyright, ratings (for browsers with ratings enabled), and a whole host of other things.

Here's what w3schools says about the meta tag:

http://www.w3schools.com/tags/tag_meta.asp

The redirection call is a type of "http-equiv" meta tag.

.c
  • harryhood
  • Graduate
  • Graduate
  • harryhood
  • Posts: 141

Post 3+ Months Ago

Carnix wrote:
harryhood wrote:
Regarding where on the page it goes I'm sure you are correct that should go between the header tags. But it will work within the body tags, which is where it happened to be on an example page that I was looking at when I made my original post.


Understandable, and I'm sure it would work anyway, at least in IE, if not other browsers. However, sometimes simply because it works doesn't mean it's the right way to do it...



True. I've probably never checked that in any other browser but IE.

Post Information

  • Total Posts in this topic: 16 posts
  • Users browsing this forum: Bogey and 116 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.