Welcome to WebmasterWorld Guest from 54.162.239.134

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Rewrite Extension But Exlude Certain Directories

     
1:00 am on Dec 4, 2008 (gmt 0)

10+ Year Member



So I'm converting a site to WordPress and keeping the URLs for the content the same except removing the .php extension. My htaccess looks like this


#RewriteCond %{THE_REQUEST} ^GET\ /([^/]+/)*[^.]+\.php(\?[^\ ]*)?\ HTTP/
#RewriteRule ^(([^/]+/)*[^.]+)\.php$ http://www.domain.com/$1 [R=301,L]

The problem is the script is trying to remove the extension from even the WordPress scripts. How do I make it so the 3 default WordPress folders and the handful of WordPress scripts in the root are not rewritten?

1:14 am on Dec 4, 2008 (gmt 0)

10+ Year Member



NM, just added this to the beginning

RewriteCond %{REQUEST_FILENAME} !-f

2:08 am on Dec 4, 2008 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I suspect you also removed the "#" symbols from those lines: Otherwise, they are just treated as comments...

If possible, use a specific exclusion pattern based on the WP script names or on the common directory path to those scripts, rather than checking the disk for "file exists" for each and every .php file requested from your server. The fewer file-exists and directory-exists checks you do, the longer it will be before your successful site has to be moved to a dedicated server... :)

Jim

2:12 am on Dec 4, 2008 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Use more RewriteCond lines to exclude those folders from applying.

A ! means NOT, here.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month