Results 1 to 14 of 14
  1. #1
    ABW Ambassador John Kruger's Avatar
    Join Date
    January 18th, 2005
    Location
    At my computer
    Posts
    645
    htaccess help
    I need someone to help with an htaccess file for my godaddy hosting.

    I want to host different urls in directories of their own, but cannot get the htaccess to work correctly.

    John
    Respectfully,

    John

    ----------------------------------------------
    work = Initiate Demand
    passion = Global Ground Work

  2. #2
    Newbie r2pro's Avatar
    Join Date
    January 23rd, 2008
    Location
    Baltimore
    Posts
    29
    Are you trying to rewrite URL's of the same domain to a virtual directory structure?

    ie widgets.com?cat=superwidgets to widgets.com/superwidgets/

    -or-

    Are you trying to host multiple domains in the same server in different directories?

    ie widget.com to myweberver.com/usr/widget

    Or is it something different all together?

    Either way, could you give an example of what you currently have?

  3. #3
    ABW Ambassador John Kruger's Avatar
    Join Date
    January 18th, 2005
    Location
    At my computer
    Posts
    645
    multiple domains on the same server
    Respectfully,

    John

    ----------------------------------------------
    work = Initiate Demand
    passion = Global Ground Work

  4. #4
    Believe knight01's Avatar
    Join Date
    August 14th, 2006
    Location
    Dayton, Ohio
    Posts
    1,815
    So, you want to have example.com resolve to mysite.com/example or do you want example.com to resolve to example.com?

    Try something like this and see if it does what you want.
    Code:
    Redirect 301 / http://www.mysitename.com/example
    Putting it in the root of example.com

    If you have cpanel as a control panel you could also park the example.com on mysite.com/example although I think that is frowned upon by SEs and SEOs.
    Someday starts today
    Military Discounts

  5. #5
    Newbie r2pro's Avatar
    Join Date
    January 23rd, 2008
    Location
    Baltimore
    Posts
    29
    RewriteEngine on
    RewriteRule ^www\.([^.]+)\.widget\.com(.*) /usr/widget$1$2


    should do the trick where widget.com is your virtual domain, this will even allow for subdomains on your virtual domain

  6. #6
    ABW Ambassador John Kruger's Avatar
    Join Date
    January 18th, 2005
    Location
    At my computer
    Posts
    645
    thank you very much.

    I had created one similar, ok, someone else created it for me, but somehow I deleted it.

    John
    Respectfully,

    John

    ----------------------------------------------
    work = Initiate Demand
    passion = Global Ground Work

  7. #7
    Believe knight01's Avatar
    Join Date
    August 14th, 2006
    Location
    Dayton, Ohio
    Posts
    1,815
    Quote Originally Posted by r2pro
    RewriteEngine on
    RewriteRule ^www\.([^.]+)\.widget\.com(.*) /usr/widget$1$2


    should do the trick where widget.com is your virtual domain, this will even allow for subdomains on your virtual domain
    r2pro,
    I hope this isn't asking too much. Could you break that down? I've tried learning to rewrite from tutorials and always get lost with what is doing what and why.
    Someday starts today
    Military Discounts

  8. #8
    Newbie r2pro's Avatar
    Join Date
    January 23rd, 2008
    Location
    Baltimore
    Posts
    29
    The first line simply turns the mod_rewrite module on and needs to be in the file for any url rewriting to be done. I use it often to change long dynamic GET variable strings into "static looking" filenames, for example:

    RewriteRule ^([a-zA-Z0-9_]+)-([a-zA-Z0-9]+)-travel-guide.html /travel-guide.html?city=$1&state=$2 [L]

    renames /Washington-DC-travel-guide.html to /travel-guide.html?city=washington&state=DC

    But back to the original example.

    The second line is composed of three parts
    1) RewriteRule which is just the command

    2) ^www\.([^.]+)\.widget\.com(.*) is the 'needle' so to speak. It instructs apache to look for URL stings that match that regular expression. Every thing is a literal, except for that which is contained in parentheses. You'll notice two parentheses sets.

    3)The last part is what the rewrite engine will transform any matches from part 2. It starts off with the literal directory /usr/widget The $1 represents whatever is matched by the first set of parentheses which could be nothing or a subdomain. The $2 matches whatever is found in the, you guessed it, second group of parentheses. Which is the file name requested

    So if someone typed in http://www.bolts.widgets.com/aboutus.html the rewrite engine would translate that to

    /usr/widgetsbolts/aboutus.html

    on the local webserver

    or http://www.widgets.com/products/topsellers.html
    to

    /usr/widgets/products/topsellers.html

    So generally speaking, you write the structure of what you are looking to rename to, and anyplace something can change (a variable), you enclose it in parentheses and put in the character set your looking to match.

    Then you write the second part with the basic structure of what it really is and you plug the variables from the previous part into it.

    The following site is good for regex tutorials:
    http://www.regular-expressions.info/

  9. #9
    ABW Ambassador John Kruger's Avatar
    Join Date
    January 18th, 2005
    Location
    At my computer
    Posts
    645
    r2pro - thanks for the tutorial

    John
    Respectfully,

    John

    ----------------------------------------------
    work = Initiate Demand
    passion = Global Ground Work

  10. #10
    ABW Ambassador John Kruger's Avatar
    Join Date
    January 18th, 2005
    Location
    At my computer
    Posts
    645
    After reading a few other posts, will this structure or using redirects have a negative impact on search engines?

    John
    Respectfully,

    John

    ----------------------------------------------
    work = Initiate Demand
    passion = Global Ground Work

  11. #11
    Newbie r2pro's Avatar
    Join Date
    January 23rd, 2008
    Location
    Baltimore
    Posts
    29
    As far as I know rewriting urls have no effect on search engines. It appears to any http client that the rewritten url is genuine.

    I can't really say about redirects, as I have never used them for any purpose. I vaguely recall that Google prefers one method of using redirects for some purposes, like changing a domain name of an established site. But I don't recall the specifics. Just google "SEO effect of ".x method and go with something that looks credible : )

  12. #12
    ABW Ambassador John Kruger's Avatar
    Join Date
    January 18th, 2005
    Location
    At my computer
    Posts
    645
    Is there a way to write this with wildcards or will it always need the specifics for each domain/folder?

    (I am trying to just host a few sites under an older godaddy account)


    So, I ftp into my main site and the structure is like this:

    www.mainsite.com

    >www
    >>site1.com
    >>site2.com
    >>site3.net

    and so on?
    Last edited by John Kruger; February 7th, 2008 at 02:45 PM. Reason: I just cannot type today
    Respectfully,

    John

    ----------------------------------------------
    work = Initiate Demand
    passion = Global Ground Work

  13. #13
    general fuq mrbshouse's Avatar
    Join Date
    January 18th, 2005
    Location
    Argieville
    Posts
    1,381
    I'm hoping to learn something new here, but i think you will need some dns records such as an "c name" to point a separate domain name to a subfolder.

    does godaddy offer the addon domains? if so use their control panel to point things in the right direction.

  14. #14
    Newbie r2pro's Avatar
    Join Date
    January 23rd, 2008
    Location
    Baltimore
    Posts
    29
    Yes you will need to write a new line with the domain and the folder hard coded in for each domain you want to redirect.

    The .htaccess rewrite rules get parsed and checked in order that they are written in your file. So if you wrote a regular expression that matched any domain name, then every domain on your server would get rewritten to the first subdirectory you used.

    As far as DNS records go, CNAME records are for aliases, if I wanted widgetey.widgets.com to point to www.yourwidgets.com I'd use a CNAME record. But redirecting one domain to another on the same server would not allow you to have different files for all of your domains. widgets.com, widgets1.com, widgets2.com, etc would all point to the same server and the same directory, so your index.html file for widgets.com would also be seen by all other domains visitors.

    For what John wants to do, you just use normal A records like you would on any other server.

    And as far as addon domains available through various hosting companies, this is basically what they do in order to add on your domain, you just have a point & click interface in your control panel in setting it up.

  15. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Need help with .htaccess
    By womanht in forum Programming / Datafeeds / Tools
    Replies: 5
    Last Post: February 17th, 2011, 10:30 PM
  2. .htaccess maybe?
    By Kevin in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: December 5th, 2006, 10:09 AM
  3. Getting rid of htaccess
    By BrattyKitty in forum Programming / Datafeeds / Tools
    Replies: 8
    Last Post: December 24th, 2004, 04:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •