htaccess in two places?

Discussion in 'Apache' started by bukovelproperty, Mar 10, 2008.

  1. #1
    Hi,

    I have joomla installed on one website in the root directory and there is an htaccess in the root file associated with that.

    I have installed Open Realty in a folder called /bukovelproperty
    and pointed the www.bukovelproperty.com domain at that directory

    Two problems: one when I turn on the SEO URL. I get errors. I think this is because I need to specify that the htaccess file for Open Realty is in a folder not the root?

    Also, the google ads are show wrong content when someone goes to the domain....but when they click on "Home Page" (which goes to index.php) it shows related adverts. I am also with 1and1 if that makes a difference - I remember having to change something in the htaccess file for joomla when i installed that to get the SEO URL working.

    Is this the same issue?

    Below are the htaccess files

    THE HTACCESS IN ROOT directory

    ##
    # @version $Id: htaccess.txt 4094 2006-06-21 18:35:46Z stingrey $
    # @package Joomla
    # @copyright Copyright (C) 2005 - 2006 Open Source Matters. All rights reserved.
    # @license GNU/GPL
    # Joomla! is Free Software
    ##

    #####################################################
    # READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
    #
    # The line just below this section: 'Options +FollowSymLinks' may cause problems
    # with some server configurations. It is required for use of mod_rewrite, but may already
    # be set by your server administrator in a way that dissallows changing it in
    # your .htaccess file. If using it causes your server to error out, comment it out (add # to
    # beginning of line), reload your site in your browser and test your sef url's. If they work,
    # it has been set by your server administrator and you do not need it set here.
    #
    # Only use one of the two SEF sections that follow. Lines that can be uncommented
    # (and thus used) have only one #. Lines with two #'s should not be uncommented
    # In the section that you don't use, all lines should start with #
    #
    #####################################################

    ##### SOLVING PROBLEMS WITH COMPONENT URL's that don't work #####
    # SPECIAL NOTE FOR SMF USERS WHEN SMF IS INTEGRATED AND BRIDGED
    # OR ANY SITUATION WHERE A COMPONENT's URL's AREN't WORKING
    #
    # In both the 'Standard SEF', and '3rd Party or Core SEF' sections the line:
    # RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
    # May need to be uncommented. If you are running your Joomla from
    # a subdirectory the name of the subdirectory will need to be inserted into this
    # line. For example, if your Joomla is in a subdirectory called '/test/',
    # change this:
    # RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
    # to this:
    # RewriteCond %{REQUEST_URI} ^(/test/component/option,com) [NC,OR] ##optional - see notes##
    #
    #####################################################


    ## Can be commented out if causes errors, see notes above.
    Options +FollowSymLinks

    #
    # mod_rewrite in use

    RewriteEngine On


    # Uncomment following line if your webserver's URL
    # is not directly related to physical file paths.
    # Update Your Joomla Directory (just / for root)

    RewriteBase /


    ########## Begin - Joomla! core SEF Section
    ############# Use this section if you are using a 3rd party (Non Joomla! core) SEF extension - e.g. OpenSEF, 404_SEF, 404SEFx, SEF Advance, etc
    #
    #RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
    RewriteCond %{REQUEST_URI} (/|\.atom|\.rss|\.htm|\.php|\.pdf|\.html|/[^.]*)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) index.php
    #
    ########## End - Joomla! core SEF Section

    HTACCESS file in /bukovelproperty

    # SEARCH ENINGE FRIENDLY URLS FOR OR 2.0
    <IfModule mod_php4.c>
    php_value session.use_trans_sid 0
    </IfModule>

    RewriteEngine On
    Rewriterule ^index.html index.php
    RewriteRule listing-([^-]*)-([0-9]*).html index.php?action=listingview&listingID=$2 [L]
    RewriteRule page-([^-]*)-([0-9]*).html index.php?action=page_display&PageID=$2 [L]
    RewriteRule search.html index.php?action=searchpage [L]
    RewriteRule searchresults.html index.php?action=searchresults [L]
    RewriteRule agents.html index.php?action=view_users [L]
    RewriteRule view_favorites.html index.php?action=view_favorites [L]
    RewriteRule calculator.html index.php?action=calculator&popup=yes [L]
    RewriteRule saved_searches.html index.php?action=view_saved_searches [L]
    RewriteRule listing_image_([0-9]*).html index.php?action=view_listing_image&image_id=$1 [L]
    RewriteRule logout.html index.php?action=logout [L]
    RewriteRule member_signup.html index.php?action=signup&type=member [L]
    RewriteRule agent_signup.html index.php?action=signup&type=agent [L]
    RewriteRule member_login.html index.php?action=member_login [L]
    RewriteRule edit_profile_([0-9]*).html index.php?action=edit_profile&user_id=$1 [L]
    # SEO Link for Agent Pages added in Open-Realty 2.4.1
    RewriteRule agent-([^-]*)-([0-9]*).html index.php?action=view_user&user=$2 [L]
     
    bukovelproperty, Mar 10, 2008 IP
  2. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #2
    then your htaccess should be at
    www.bukovelproperty.com/.htaccess

    if valid for entire domain and all its subfolders on bukovelproperty.com

    do you have 2 sites on same directory ??
    what is the 1st site ( url )?
     
    hans, Mar 10, 2008 IP
  3. bukovelproperty

    bukovelproperty Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks for fast reply.

    I have one area for files.

    First url is www.simplybukovel.com which points to the root

    when I log into my ftp site, in the root is the first htaccess I posted. and in the /bukovelproperty folder is the other one. I've pointed www.bukovelproperty.com to this folder

    Does that help? I hope Im explaining this correctly?!
     
    bukovelproperty, Mar 10, 2008 IP
  4. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #4
    your folder/site situation is still UNprecise in your description.
    but
    ftp login may be different from domain root. usually login is one folder HIGHER than public files ( domain root ).

    domain root and ALL its SUB-folders is what apache reads each time to locate .htaccess
    hence you .htaccess needs to be at public ( domain ) root OR nay of its SUBfolders if valid only in subfolders.
    if however .htaccess

    if however you have your .htaccess HIGER than domain root - then your htaccess is INACTIVE as appache reads only from domain root and (sub-)subfolders but never higher folders.

    if still unclear then please post your FULL path to login folder and to PUBLIC root-folder
     
    hans, Mar 10, 2008 IP
  5. bukovelproperty

    bukovelproperty Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'll try and explain again:

    I have one hosting package. I have two domain names. I ftp into the root.

    www.simplybukovel.com points to the root
    www.bukovelproperty.com points to folder in the root called bukovelproperty

    I run open realty in the bukovelproperty folder. There is an .htaccess file in that folder.

    Also, there is an .htaccess file in my root directory.

    How can I tell Open Realty to use the .htaccess file in my bukovelproperty folder?

    Can you see my adverts display incorrect information when yuo go to www.bukovelproperty.com

    but they show related skiing ones when you go to www.bukovelproperty.com/index.php

    ??
     
    bukovelproperty, Mar 10, 2008 IP
  6. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #6
    pls give the full absolute server-PATH to your BOTH root folders
    login by telnet or SSH ( and if linux server ) do a

    pwd

    and publish output of path here
     
    hans, Mar 10, 2008 IP
  7. bukovelproperty

    bukovelproperty Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    www.simplybukovel.com

    /homepages/29/d232980298/htdocs/

    www.bukovelproperty.com

    /homepages/29/d232980298/htdocs/bukovelproperty/
     
    bukovelproperty, Mar 10, 2008 IP
  8. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #8
    so you will have one .htaccess each at

    /homepages/29/d232980298/htdocs/.htaccess
    and
    /homepages/29/d232980298/htdocs/bukovelproperty/.htaccess

    it appears you may have 1and1 hosting
    make sure your index file is correctly defined in your htaccess OR apache config ( you may be find one 1 or 2 level HIGHER if you login SSH ) to assure your

    www.bukovelproperty.com/index.php
    and
    www.bukovelproperty.com/
    are identical
    also for Google mediabot

    if syntax/code in htaccess is correct
    then apache ALWAYS uses the htaccess of the proper domain root ( or subfolder of sub(sub)folder have a different htaccess.

    hence in your case of all htaccess correct, then
    /homepages/29/d232980298/htdocs/bukovelproperty/.htaccess
    always automatically is used for
    www.bukovelproperty.com
    and all its subfolder(s)

    when TESTING
    make sure you never test in a subfolder with YOUR browser !!!!
    always start at root level with your browser to assure that htaccess is READ at least ONCE by apache.
    I have noticed that when surfing in SUBFOLDERS while changing/testing htaccess in top level leaves htaccess UNtouched by APACHE in certain test cases.
    visitors are NOT affected by that behavior since they visit first time and apache reads top level htaccess for first time visitors.
     
    hans, Mar 10, 2008 IP
  9. bukovelproperty

    bukovelproperty Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    This is the htaccess file in OR directory. What do you mean by index file correctly defining index file in htaccess? Is the following correct?

    Can you see the difference when going to the www.bukovelproperty.com and look at ads at bottom, then click on homepage at top and it shows index.php and ads are related to skiing?

    Thanks so much for your help



    # SEARCH ENINGE FRIENDLY URLS FOR OR 2.0
    <IfModule mod_php4.c>
    php_value session.use_trans_sid 0
    </IfModule>

    RewriteEngine On
    Rewriterule ^index.html index.php
    RewriteRule listing-([^-]*)-([0-9]*).html index.php?action=listingview&listingID=$2 [L]
    RewriteRule page-([^-]*)-([0-9]*).html index.php?action=page_display&PageID=$2 [L]
    RewriteRule search.html index.php?action=searchpage [L]
    RewriteRule searchresults.html index.php?action=searchresults [L]
    RewriteRule agents.html index.php?action=view_users [L]
    RewriteRule view_favorites.html index.php?action=view_favorites [L]
    RewriteRule calculator.html index.php?action=calculator&popup=yes [L]
    RewriteRule saved_searches.html index.php?action=view_saved_searches [L]
    RewriteRule listing_image_([0-9]*).html index.php?action=view_listing_image&image_id=$1 [L]
    RewriteRule logout.html index.php?action=logout [L]
    RewriteRule member_signup.html index.php?action=signup&type=member [L]
    RewriteRule agent_signup.html index.php?action=signup&type=agent [L]
    RewriteRule member_login.html index.php?action=member_login [L]
    RewriteRule edit_profile_([0-9]*).html index.php?action=edit_profile&user_id=$1 [L]
    # SEO Link for Agent Pages added in Open-Realty 2.4.1
    RewriteRule agent-([^-]*)-([0-9]*).html index.php?action=view_user&user=$2 [L]
     
    bukovelproperty, Mar 10, 2008 IP
  10. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #10
    I am no expert in mod_rewrite
    but it appears to me that your first line might be better served by the
    http://httpd.apache.org/docs/2.0/mod/mod_dir.html#directoryindex
    (or the appropriate OTHER apache version depending on what exactly you are using.

    hence I would REMOVE from mod_rewrite rules the line
    Rewriterule ^index.html index.php

    and instead use the default apache config

    DirectoryIndex index.php
     
    hans, Mar 10, 2008 IP