4 replies
I have an unlimited hosting account with Hostgator. The main site I have hosted is a directory using PHP Link Directory. This has a .htaccess file in the root folder.

Here comes the problem. If the .htaccess file is present, none of the password protected directories in the addon domains work. If I remove the .htaccess file, the domains work fine but none of the links in the main site work.

Can anyone help me modify my file?

Here is the file:

Code:
#######################################################
## PHP Link Directory 4.0.0 - Apache Server Settings ##
#######################################################

# Prevent .htaccess and .htpasswd files from being viewed by web clients
<Files "^\.ht">
    Order allow,deny
    Deny from all
</Files>

# Protect files
<Files ~ "^(.*)\.(inc|inc\.php|tpl|sql)$">
  Order deny,allow
  Deny from all
</Files>

# Protect directories
<Files ~ "^(backup|files|images|include|lang|libs(/.+)?|temp(/.+)?|templates(/.+)?|javascripts(/.+)?)$">
  Order deny,allow
  Deny from all
</Files>

# Disable directory browsing
Options -Indexes

# Follow symbolic links in this directory
Options +FollowSymLinks

# Override PHP settings that cannot be changed at runtime
# (If your server supports PHP settings via htaccess you can comment following two lines off)
# php_value register_globals   0
# php_value session.auto_start 0

# Customized error messages
# ( If you are running in a subfolder please add it, example: "directory/index.php?httpstatus=404" )
ErrorDocument 404 index.php?httpstatus=404

# Set the default handler
DirectoryIndex index.php

# URL rewrite rules
<IfModule mod_rewrite.c>
   RewriteEngine On


   #Make sure RewriteBase points to the directory where you installed phpLD.
   #Example: "/phpld" if your installation is in a "phpld" subdirectory.

   #RewriteBase /

   ##Latest Links Rewrite
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule ^latest-links\.htm[l]?$ index.php?list=latest [QSA,NC,L]

   ##Top Hits Rewrite
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule ^top-hits\.htm[l]?$ index.php?list=top [QSA,NC,L]

   ##Latest Articles Rewrite
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule ^latest-articles\.htm[l]?$ index.php?list=latestarticles [QSA,NC,L]

   ##Details Link Page Rewrite
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule (.*)detail/(.*)$ detail.php?id=$2 [QSA,NC]

   ##Article Page Rewrite
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule (.*)articles/(.*)$ article.php?id=$2 [QSA,NC]

   ##Author Page Rewrite
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule (.*)authors/author-(.*)\.htm[l]?$ author.php [QSA,NC]
 
   ##Owner Page Rewrite
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule (.*)owner/owner-(.*)\.htm[l]?$ author.php [QSA,NC]

   ##Pagination Rewrite
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule (.*)page-[0-9]+\.html$  index.php [QSA,NC,L]

   ##Pages redirect
   RewriteCond %{REQUEST_URI} !page-[0-9]+\.html?$
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule ^(.+)\.html$ page.php?name=$1 [NC,QSA,L]

   RewriteRule ^(.*)loadingAnimation.gif$ javascripts/thickbox/loadingAnimation.gif

   ##Category redirect
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
#htaccess #issue
  • Profile picture of the author stma
    The denyfromall bit is whats fouling you up. Looks like you are denying all htaccess files in sub folders -- hence a htaccess protect won't work.

    <Files "^\.ht">
    Order allow,deny
    Deny from all
    allow from 192.178.012
    </Files>


    (replace that ip with yours - and give it a test) Find your ip at whatismyip.com
    {{ DiscussionBoard.errors[2017268].message }}
  • Profile picture of the author Shounak Gupte
    should i just add this bit of code anywhere in the file?
    Signature
    Looking for a quality but affordable graphic designer to partner with. To express your interest PM me with some samples.
    {{ DiscussionBoard.errors[2017336].message }}
  • Profile picture of the author stma
    No - you are editing the first block of your htaccess file. Looks like this originally:

    <Files "^\.ht">
    Order allow,deny
    Deny from all
    </Files>
    {{ DiscussionBoard.errors[2017348].message }}
  • Profile picture of the author casius
    Also what CMS do you use for your website?
    Signature
    Cloud VPS || Shared Hosting
    Web Hosting Solutions for Geeks!
    HOST1PLUS
    {{ DiscussionBoard.errors[2018378].message }}

Trending Topics