htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Making folders/files/password-protection work with 3rd party
PostPosted: 30 Jan 2007 13:44 
Offline
User avatar

Joined: 25 Sep 2006 04:48
Posts: 242
Getting 403's when you enable permalinks?
Add this to the top of your .htaccess file
Options +SymLinksIfOwnerMatch

Making stats accessible with htaccess
From DreamHost

Many CMS and blog tools install a .htaccess file that makes our stats unreachable, including our Wordpress 2.0 (http://wordpress.org/) one-click install and the Drupal (http://drupal.org/) and Textpattern (http://textpattern.com/) CMS systems. For these examples we will use a Wordpress .htaccess file. (Drupal instructions.)

This problem does not apply to a Wordpress blog installed in a sub directory of your server. (For example, a blog at domain.com/ will be affected, but a blog at domain.com/blog/ will not be.)

Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>
# END WordPress



To fix this you need to add the following lines to your .htaccess before the section added by Wordpress:

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/failed_auth.html$
RewriteRule ^.*$ - [L]
</IfModule>


Those lines are self contained, so you can put them at the beginning of any .htaccess file to fix stats, they won't interfere with other .htaccess operations.

The final .htaccess file for Wordpress would look like:

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
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
</IfModule>
# END WordPress


The repeated lines won't cause any problems, and are necesary because Wordpress 2.0 has taken to doing whatever it pleases to the stuff within the Wordpress section.

The same basic idea works for Textpattern. Here's a sample .htaccess for Textpattern.

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
# Dreamhost stats
RewriteBase /
RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/failed_auth.html$
RewriteRule ^.*$ - [L]

# Textpattern
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteRule ^(.*) index.php
</IfModule>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
Powered by phpBB