Forum Moderators: phranque

Message Too Old, No Replies

Newbie Alias Question

         

Capt_Mac

9:28 pm on Apr 30, 2005 (gmt 0)

10+ Year Member



Hi,

I'm dumb as a rock when it comes to scripting stuff, so please bare with me.

Is there a way of of getting an alias to my site sent to a specific directory? If so, how so? I've heard that htaccess would be the way to go.

Any help would be appreciated.

jonrichd

6:40 pm on May 2, 2005 (gmt 0)

10+ Year Member



Mac,

Welcome to WebmasterWorld.

It's not clear from your question what you mean by 'alias to my site'. Perhaps that's why there haven't been any responses yet.

I can think of a few things you might be trying to do, and will give some general suggestions.

If what you are trying to do is have a separate domain point to a specific directory on your site (e.g. you have mydomain.com as well as mywidgets.com, and you want mywidgets.com to display mydomain.com/widgets/index.htm) your best bet is probably through DNS. The procedure is going to depend on your web host; on mine, I can go into my control panel, add an additional domain, and specify the root directory of the domain.

You could also do this with .htaccess, using something like:


RewriteEngine on
RewriteCond %{HTTP_HOST} ^mywidgets\.com
RewriteRule (.*) [mydomain.com...] [R=301,L]

The other thing you may be trying to do is to is redirecting a directory to a filename to make an easy to remember URL (e.g. you want www.mydomain.com/widgets/ to redirect to www.mydomain.com/pages/html/long-name/widgets.htm

In this case, use


RewriteEngine on
RewriteCond %{REQUEST_URI} ^/widgets/ [NC]
RewriteRule (.*) [mydomain.com...] [R=301,L]

If you're trying to do something else, let us know, and I'm sure someone will have an answer.

Capt_Mac

11:38 pm on May 2, 2005 (gmt 0)

10+ Year Member



Thanks for the help!

Here's what I ended up using:

RewriteEngine on
RewriteCond %{HTTP_HOST} www.widgets\.com [NC]
RewriteCond %{REQUEST_URI}!/widgets_folder
RewriteRule (.*) /widgets_folder/$1 [L]