Phpld canonical htaccess

Discussion in 'Apache' started by k9webdesign, Jun 19, 2011.

  1. #1
    Hello all,

    I saw a similar post where a guy was having problems with url rewriting on phpld directory script and while my problem is similar (but different) I wondered if you guys would be kind enough to help me too...

    My problem is that my directory has somehow ended up with the http://mydomain.com/category urls indexed instead of the www. versions and now need to set about correcting this.

    My htaccess is pasted below and I wondered if someone would be so kind to modify if for me so it sends ANY http://domain.com/url to its http://www.domain.com/url

    I would be overjoyed if someone could fiigure it out.

    Many thanks in advance

    Andy:

    #######################################################
    ## PHP Link Directory 4.1.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>
    
    Code (markup):
     
    k9webdesign, Jun 19, 2011 IP
  2. dvduval

    dvduval Notable Member

    Messages:
    3,372
    Likes Received:
    356
    Best Answers:
    1
    Trophy Points:
    260
    #2
    If you want to post this over in the phpLD forums I will be glad to get an answer for you.
     
    dvduval, Jun 21, 2011 IP
  3. k9webdesign

    k9webdesign Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks David, just posted it in the 'phpLD 3.x and 4.x Forum' section.

    Andy
     
    k9webdesign, Jun 21, 2011 IP