www.webdeveloper.com
Results 1 to 2 of 2

Thread: .htaccess rewrite duplicating URI

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Location
    Boston, MA
    Posts
    31

    Exclamation .htaccess rewrite duplicating URI

    Hey folks,

    I have an issue with a rewrite on my site. I will start with the symptom and then dig into the intended goal, setup and history.


    Okay...so, the goal of this is to support multiple websites on a shared hosting account. For example, I have abovethefolddesign.com and dev.abovethefolddesign.com. Each site is placed into it's own folder under the root and named respectively.

    1. In the root of the hosting account, I have an .htaccess file with the following code:

    Code:
    Options +FollowSymlinks
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^(w{1,3}\.)?abovethefolddesign\.com$
    RewriteCond $1 !^abovethefolddesign.com/
    RewriteRule (.*) /abovethefolddesign.com/$1 [L]
    If I remove this .htaccess, then I will get a directory listing of my account - not good.

    In the /abovethefolddesign.com/blog folder, I have an .htaccess file with the following code:

    Code:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /blog/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]
    </IfModule>
    # END WordPress
    If I remove this .htaccess, I will get a 404 for each blog post (but the main blog post page works fine.)

    Couple other pieces of info: a) I am not an .htaccess wizard, b) Only the files of /blog are Wordpress, the rest of the site is custom.

    Can someone help with streamlining this and making the site work as it should?

  2. #2
    Join Date
    Nov 2010
    Posts
    2
    First, you do not say, what you actually want your .htaccess to do. You just say you get errors. The last thing, I understand. But let me try something ...

    I'd suggest, you delete the stuff in your root .htaccess and replace with [some' like] :
    ----------------------------------
    # Which file needs to be loaded? And I'd suggest a .PHP [any server-side] file first
    DirectoryIndex my-index.php /blog/index.php any-index.html /my-error-root/404.php

    # Disable directory browsing; sometimes doesn't work with some servers. Then delete.
    Options All -Indexes
    ----------------------------------
    As you are no .htaccess expert, you'd better just tell the .htaccess to load a [.PHP] file.
    In dev.abovethefolddesign.com, the [.PHP] file could do different things, then in www.abovethefolddesign.com. Your .htaccess looks very crappy to me and as the root .htaccess will work on every directory, just delete your .htaccess there and have a [.PHP] file do what you want. Just a suggestion for a simple solution, as .PHP [or any server-side environment] will be more easy to control for you and acts rather the same as the .htaccess instructions you (propably) show me.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles