+ Reply to Thread
Results 1 to 3 of 3

Thread: htaccess mod_rewrite help

  1. #1
    nterror is offline x10 Sophmore nterror is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    112

    htaccess mod_rewrite help

    I have a couple websites on my server. Problem is that I can get to them by going to:

    hostsite.tld/secondsite/

    How do I redirect this to: secondsite.tld



    Second, I don't want WWW on secondsite.tld. I Googled and tried many variations with no luck. If I go to the main page, it works. But if I go to something like this it does not:
    http://www.secondsite.tld/page.html

    I also have an open directory (secondsite.tld/public/)with its own htaccess with indexes enabled (as well as custom header/footer, the works), and adding any WWW removal rule gives me a 403 Forbidden error when trying to access the directory. Any ideas?

    TIA

  2. #2
    OdieusG is offline x10Hosting Member OdieusG is an unknown quantity at this point
    Join Date
    Jan 2009
    Location
    Bangor, Maine
    Posts
    50

    Re: htaccess mod_rewrite help

    These are JUST the pages you need! I looked into it, and it's good to use if you want a directory-like site

    Code:
    http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html
    http://www.sitepoint.com/article/guide-url-rewriting/2/
    The best to understand it would be the SitePoint link. That one tells your basics.....you might want to look into RegEx if you're going extensive, like:
    Code:
    http://mysite.com/2009/12/25
    going to
    Code:
    http://mysite.com/date.php?yy=2009&m=12&d=25
    But these should help a bit in the basics of mod_rewrite at least

    And yes, I see I put Christmas down......

  3. #3
    nterror is offline x10 Sophmore nterror is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    112

    Re: htaccess mod_rewrite help

    I was able to fix the open directory by adding a + in front of Indexes.

    And for some reason adding ifModule tags around mod_rewrite makes it work every time.
    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
    RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
    </IfModule>
    Thanks for the links, I'm using those for the subdirectory redirect.
    Last edited by nterror; 05-20-2009 at 09:15 AM.

+ Reply to Thread

Similar Threads

  1. Htaccess - regular expressions
    By lair360 in forum Tutorials
    Replies: 1
    Last Post: 05-04-2009, 12:48 AM
  2. Replies: 8
    Last Post: 01-29-2009, 03:01 PM
  3. HTACCESS Help
    By takuhii in forum Free Hosting
    Replies: 2
    Last Post: 09-30-2008, 03:35 PM
  4. 500 Internal Server Error (oscommerce site)
    By monster061 in forum Free Hosting
    Replies: 18
    Last Post: 12-28-2007, 03:10 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
x10hosting free hosting for the masses
dedicated servers