Forums

[resolved] .htaccess : can't figure this out (9 posts)

  1. macwise
    Member
    Posted 5 years ago #

    I could really use some brain/eye-power on this one. I'm having a lot of issues with my wordpress install right now. So many I can't list in one (or five) posts. So here's the single biggest one I need to get me going for now:

    .htaccess redirects; Halfway working:

    When I go to babyquestions101.com it redirects me to http://www.babyquestions101.com

    HOORAY!!!

    However, if I go to babyquestions101.com/forum then it don't do a dang thing. It just sits there and smiles at me like a kid on his brand new birthday trike. Oh, sure, it serves up the page like one might expect. But I really need it to redirect to http://www.babyquestions101.com before it serves the page so that the cookie information that's stored matches the url currently being visited by the user, otherwise they don't appear to be logged in.

    I have tried everything I can think of, scoured the web for a solution. I notice that here at the wordpress support forum, when I visit http://www.wordpress.org/support/ it forwards me to wordpress.org/support/. I know this is possible, but I'm pretty much out of ideas. I'm sure I'm giving too little/the wrong information...please, ask any questions that I might be able to help track down this erroneous behavior on my site. Thanks!

    Here is my .htaccess file in my wordpress root directory:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    
    ### set all page requests to go to www.babyquestions101.com
    RewriteCond %{HTTP_HOST} !^www.babyquestions101.com$ [NC]
    RewriteRule ^(.*)$ http://www.babyquestions101.com/$1 [R=301,L]
    
    RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR]
    RewriteCond %{REQUEST_URI} ^/failed_auth.html$
    RewriteRule ^.*$ - [L]
    </IfModule>
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
  2. Otto
    Tech Ninja
    Posted 5 years ago #

    That code should work. Is there another .htaccess file in the forum directory? It's possible that that could interfere, because of the way .htaccess processing works. Don't change anything yet, but post the contents of that other .htaccess file so we can see it and work out what's going on in what order.

  3. macwise
    Member
    Posted 5 years ago #

    Thanks for your reply, Otto. I'm really scratching my head on this one. I can't seem to get past this, nor can my veteran web developer buddy, (though he is mostly familiar with .net). Here's the code from my BBPress install directory's .htaccess file:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /forum/
    RewriteRule ^forum/([0-9]+)/page/([0-9]+)$ /forum/forum.php?id=$1&page=$2 [L,QSA]
    RewriteRule ^contest/$ /forum/contest.php [L,QSA]
    RewriteRule ^contest$ /forum/contest.php [L,QSA]
    RewriteRule ^forum/([0-9]+)$ /forum/forum.php?id=$1 [L,QSA]
    RewriteRule ^topic/([0-9]+)/page/([0-9]+)$ /forum/topic.php?id=$1&page=$2 [L,QSA]
    RewriteRule ^topic/([0-9]+)$ /forum/topic.php?id=$1 [L,QSA]
    RewriteRule ^tags/(.+)/page/([0-9]+)$ /forum/tags.php?tag=$1&page=$2 [L,QSA]
    RewriteRule ^tags/(.+)/?$ /forum/tags.php?tag=$1 [L,QSA]
    RewriteRule ^tags/?$ /forum/tags.php [L,QSA]
    RewriteRule ^profile/([0-9]+)/page/([0-9]+)$ /forum/profile.php?id=$1&page=$2 [L,QSA]
    RewriteRule ^profile/([0-9]+)/([a-z]+)$ /forum/profile.php?id=$1&tab=$2 [L,QSA]
    RewriteRule ^profile/([0-9]+)/([a-z]+)/page/([0-9]+)$ /forum/profile.php?id=$1&tab=$2&page=$3 [L,QSA]
    RewriteRule ^profile/([0-9]+)$ /forum/profile.php?id=$1 [L,QSA]
    RewriteRule ^view/([a-z-]+)/page/([0-9]+)$ /forum/view.php?view=$1&page=$2 [L,QSA]
    RewriteRule ^view/([a-z-]+)$ /forum/view.php?view=$1 [L,QSA]
    RewriteRule ^rss/$ /forum/rss.php [L,QSA]
    RewriteRule ^rss/forum/([0-9]+)$ /forum/rss.php?forum=$1 [L,QSA]
    RewriteRule ^rss/topic/([0-9]+)$ /forum/rss.php?topic=$1 [L,QSA]
    RewriteRule ^rss/tags/([a-z]+)$ /forum/rss.php?tag=$1 [L,QSA]
    RewriteRule ^rss/profile/([0-9]+)$ /forum/rss.php?profile=$1 [L,QSA]
    </IfModule>
    
  4. Otto
    Tech Ninja
    Posted 5 years ago #

    Ahh. There you go. Rewrites can be an odd beast sometimes.

    Change this:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /forum/
    RewriteRule ^forum/([0-9]+)/page/([0-9]+)$ /forum/forum.php?id=$1&page=$2 [L,QSA]
    RewriteRule ^contest/$ /forum/contest.php [L,QSA]
    ...

    To this:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /forum/
    RewriteCond %{HTTP_HOST} !^www.babyquestions101.com$ [NC]
    RewriteRule ^(.*)$ http://www.babyquestions101.com/$1 [R=301,L]
    RewriteRule ^forum/([0-9]+)/page/([0-9]+)$ /forum/forum.php?id=$1&page=$2 [L,QSA]
    RewriteRule ^contest/$ /forum/contest.php [L,QSA]
    ...
  5. macwise
    Member
    Posted 5 years ago #

    Ok, Otto...

    I've added these lines:

    RewriteCond %{HTTP_HOST} !^www.babyquestions101.com$ [NC]
    RewriteRule ^(.*)$ http://www.babyquestions101.com/$1 [R=301,L]

    However, now there is a new set of problems. It's probably best for you to test it out yourself to see what's going on. I actually tried this already, and the problem was extremely bizarre, hence my posting here. Maybe you can punch this into your address bar and see if you can figure out what the fix is:

    If I go here:
    babyquestions101.com/forum (without the trailing forward slash)
    then I get forwarded here:
    http://www.babyquestions101.com//home/macwise/babyquestions101.com/forum

    and if I go here:
    babyquestions101.com/forum/ (with the trailing forward slash)
    then I go here:
    http://www.babyquestions101.com/

    No matter what else I put in there I can't seem to make that first situation disappear. (where the full path appears).

    Any ideas?

  6. Otto
    Tech Ninja
    Posted 5 years ago #

    Ugh... Okay, try this:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^www.babyquestions101.com$ [NC]
    RewriteRule ^(.*)$ http://www.babyquestions101.com/$1 [R=301,L]
    RewriteBase /forum/
    RewriteRule ^forum/([0-9]+)/page/([0-9]+)$ /forum/forum.php?id=$1&page=$2 [L,QSA]
    RewriteRule ^contest/$ /forum/contest.php [L,QSA]
    ...

    If even that fails, then I dunno. Revert back to what it was before I told you to try anything.

  7. macwise
    Member
    Posted 5 years ago #

    dagnab....that didn't work either. Thanks for the help. I am wondering what the root problem is here. I can only imagine it has to do with one of two factors...either I inadvertently messed something up in the wordpress/bbpress code while modifying it, or the host (dreamhost.com) has a configuration problem.

    I suppose the third option might be that since I'm installed on php4 and not php5? Though I don't see that as a real viable cause. Is there any way I can see the wordpress.org mod_rewrite directives to see if I'm missing anything since what I'm trying to do seems to work just fine here?

    I AM DESPERATE! I WILL TAKE ANY AND ALL SUGGESTIONS, TRY, RETRY, AND EVEN TRY BACKWARDS IF YOU HAVE AN IDEA. I've got to get the official launch of this baby to happen...yesterday. This is me grasping at straws. Thanks for your help.

  8. macwise
    Member
    Posted 5 years ago #

    I have resolved my issues. (well wordpress related, at least) ;) I will post more tomorrow when my head isn't spinning.

  9. macwise
    Member
    Posted 5 years ago #

    Sorry for the delayed reply. Here is the info that allowed me to set any sub-domain of my domain to be recorded in the cookie automatically. Hope this helps someone else. This doesn't seem to be documented anywhere else. Look toward the end of the files

    FOR WordPress:
    http://bbpress.org/forums/topic/780?replies=8

    FOR BBPress:
    http://bbpress.org/forums/topic/798?replies=4

    Ron

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.