After a HUGE headache, and many hours wasted looking through worthless forum posts, and blog entries claiming to be able to help get URL Rewriting working I FINALLY got the damn thing working. Here’s how I did it…

It appears the problem was that in the .htaccess file that comes with PhpLD 3.3.0 there is a stray “#”. While I’m not 100% sure it’s not supposed to be there I can tell you this much- removing it got URL Rewriting working on several of my directories on the first shot.

Here’s my modified .htaccess file:

Code:
#################################################
## PHP Link Directory - 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/link-(.*)\.htm[l]?$ detail.php [QSA,NC]

   ##Article Page Rewrite
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule (.*)articles/article-(.*)\.htm[l]?$ article.php [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]

   ##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]

   ##Category redirect
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

Note that this script may need some editing. If your directory is not in the root folder, you need to add on to this part of the script. Find the part that says “RewriteBase /” and after the “/” type the folder that your directory is located in.

Hopefully, this can help save someone the frustration that I went through in getting this so-called simple setting to work.




3 Comments to “Enabling URL Rewrite for PhpLD”


  1. Pubdomains.com — July 21, 2008 @ 10:36 pm

    Hi Alex,
    So you finally got it working! Kudos to you for achieving the desired results and make it work on GoDaddy Servers.

    I have posted .htaccess to my phplinkdirectory on my blog at http://pubdomains.wordpress.com and hope you find the inputs useful.

    Perhaps we could exchange links to our directories as well if you are interested.

    Thanks for your comments on my blog and wish you good luck for your directory!

    Regards,
    Veena

  2. Jccjamna — October 22, 2008 @ 9:50 pm

    this post is fantastic maxporn videos 4517

  3. Tramadol_Arefzigreenue — October 26, 2008 @ 9:52 am

    Your Web Site is really wonderful and I bookmarked it. Thank your for the hard work you must have put in to create this wonderful facility. Keep up the excellent work!



Write a comment


You need tologin.

    
Black Hat Library is based on WordPress platform, RSS tech , RSS comments design by Gx3.