Results 1 to 4 of 4

Thread: .htaccess mod rewrite inconsistent on reload

  1. #1
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default .htaccess mod rewrite inconsistent on reload

    I can't figure out what's going on, and I'm not sure where to start in trying to fix it.

    Here's the setup:

    I have a Go Daddy hosting account that has several domains pointed to it.
    MAINDOMAIN.com is the "primary domain", which is by default set to the root directory.
    The other domains are by default pointed to folders like domain.com to directory 'domain.com/'.

    What I want:
    MAINDOMAIN.com should NOT access the root; instead, it should access a folder called 'MAINDOMAIN/'.
    I don't want any website-specific files in the root, and I don't want the websites to be potentially loaded through another (a.com/b.com/....).

    What I've done:
    I set up .htaccess with mod_rewrite to solve this. Simple. And it worked for over a year.
    Recently* this stopped working. I have no idea why. (*well, not too recently-- a few months ago, and I've been too busy/confused to fix it)

    I'm using this .htaccess code:

    Code:
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} MAINDOMAIN.com
    RewriteCond %{REQUEST_URI} !^/MAINDOMAIN
    RewriteRule ^(.*)$ MAINDOMAIN%{REQUEST_URI}

    Sometimes when I load a page, it works. Sometimes it doesn't (404). Refreshing (especially shift+refresh-- force reload everything) usually helps. Sometimes when I continuously refresh it just loops back and forth between working and not working. What's going on!??

    [EDIT: DEMO PAGES REMOVED]

    I have no idea why some pages/files are more likely to have problems than others....


    --
    Part 2:
    I also have another layer of .htaccess in one part of the website (a subdirectory).
    This is just all messed up. Some pages are loaded through a single PHP page that generates the template.
    It's inconsistent (and sometimes the poster loads, other times it doesn't).

    I assume this will be fixed once the other problem is fixed, and this is just another level of not being sure where to start in fixing it. And it's not a huge priority right at the moment. But it's still odd.



    Any ideas? Why would .htaccess be inconsistent? It's not wrong, it's just not always right.....?
    Last edited by djr33; 12-31-2013 at 08:31 PM. Reason: potentially sensitive information removed after resolving problem
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Don't know. Does GoDaddy not provide some cp functionality that allows you to choose root directories for each of your domains? I've run into confusing stuff before trying to make htaccess do the work of a vhost file.

  3. The Following User Says Thank You to traq For This Useful Post:

    djr33 (12-31-2013)

  4. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I haven't been able to find anything. That would be a simpler solution and I'd be happy with it. I can look around.
    In theory, I'd expect .htaccess should work. But as you said, it's confusing! I barely know what I'm doing with .htaccess anyway, so when the basics don't work out, I'm pretty much lost.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Update: I've solved this indirectly. There must be a primary domain setup with the root directory. So I set an irrelevant (non-existent, in fact) subdomain as the "primary"/root domain and switched my main domain to the desired folder. Now it's working fine. I still have to reconfigure some of the internal .htaccess mod_rewrite stuff, but that's fine. At least that makes sense to begin with. Thanks for motivating me to look for a workaround again.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Similar Threads

  1. rewrite single url via htaccess
    By chetanmadaan in forum Other
    Replies: 0
    Last Post: 10-03-2011, 06:56 PM
  2. .htaccess rewrite url problem
    By robert_gsfame in forum Other
    Replies: 3
    Last Post: 08-27-2010, 05:07 AM
  3. .htaccess help to rewrite URLs
    By Beverleyh in forum Looking for such a script or service
    Replies: 3
    Last Post: 06-11-2009, 12:18 PM
  4. htaccess mod rewrite
    By vineet in forum PHP
    Replies: 1
    Last Post: 12-15-2008, 12:06 PM
  5. .htaccess Rewrite URL
    By thanhnguyen in forum Other
    Replies: 2
    Last Post: 05-09-2007, 02:45 AM

Bookmarks

Posting Permissions

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