homepage Welcome to WebmasterWorld Guest from 54.167.11.16
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

This 37 message thread spans 2 pages: < < 37 ( 1 [2]     
Preventing conflicts with WP mod_rewrite code
and speeding it up as well
wheel




msg:4053975
 8:53 pm on Jan 4, 2010 (gmt 0)

I've got wordpress installed in my root folder, and some other unrelated stuff in my /cgi-bin.

When I install the wordpress permalinks htaccess in my root, stuff in my cgi-bin directory gets an access denied error message:

here's my wordpress htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

And here's what's in the <directory> block for my cgi-bin in my httpd conf file:
AllowOverride All
Options None ExecCGI
DirectoryIndex index.html
AddHandler cgi-script .cgi .pl
Order allow,deny
Allow from all

Any thoughts on what's causing my cgi-bin programs to get access denied? Or how to opt out my cgi-bin directory from the root .htaccess directives?

 

aredman




msg:4206997
 2:50 am on Sep 26, 2010 (gmt 0)

Jim:

You made a comment about making a similar modification to the htaccess file of a Joomla site. Here is a portion of my htaccess file. Would you be willing to indicate the changes necessary for me as well?

# mod_rewrite in use

RewriteEngine On

RewriteCond %{HTTP_HOST} ^ourfullhouse.com [NC]
RewriteRule ^(.*)$ [ourfullhouse.com...] [L,R=301]

# 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
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section

Much appreciated!

Andy

g1smd




msg:4207039
 7:14 am on Sep 26, 2010 (gmt 0)

The non-www to www redirect can be improved:

RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]


The above will redirect for all non-canonical hostnames, including requests with trailing port numbers, etc.



The Joomla changes are documented and discussed here:
[webmasterworld.com...]
[webmasterworld.com...]
[docs.joomla.org...]

The patch is here:
[joomlacode.org...] [1218 bytes]

aredman




msg:4207192
 7:49 pm on Sep 26, 2010 (gmt 0)

Thanks much for the input on the redirect and also the links!

Grateful,

Andy

aredman




msg:4207208
 8:35 pm on Sep 26, 2010 (gmt 0)

With the patch that you've submitted, how/where does it get applied? Does it make these changes?

########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section

to...

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html?|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [L]

aredman




msg:4207212
 8:42 pm on Sep 26, 2010 (gmt 0)

As a note, I've applied the above recommended changes to my htaccess file.

g1smd




msg:4207226
 9:41 pm on Sep 26, 2010 (gmt 0)

The patch makes the changes listed on the mentioned Joomla
docs:talk page to the .htaccess file.

The
[F,L] flag becomes just [F] and the rest of the code changes to:

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} (/(component/)?|\.(php|html?|feed|pdf|raw)|/[^.]*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]


This alone will give a noticeable speed increase for any site using Joomla.

g1smd




msg:4274728
 5:07 pm on Mar 1, 2011 (gmt 0)

Updated code for Joomla 1.5 and Joomla 1.6 is here: [webmasterworld.com...]

This 37 message thread spans 2 pages: < < 37 ( 1 [2]
Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved