homepage Welcome to WebmasterWorld Guest from 54.196.63.93
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Rewrite Extension But Exlude Certain Directories
JeremyL

10+ Year Member



 
Msg#: 3799594 posted 1:00 am on Dec 4, 2008 (gmt 0)

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?

 

JeremyL

10+ Year Member



 
Msg#: 3799594 posted 1:14 am on Dec 4, 2008 (gmt 0)

NM, just added this to the beginning

RewriteCond %{REQUEST_FILENAME} !-f

jdMorgan

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



 
Msg#: 3799594 posted 2:08 am on Dec 4, 2008 (gmt 0)

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

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3799594 posted 2:12 am on Dec 4, 2008 (gmt 0)

Use more RewriteCond lines to exclude those folders from applying.

A ! means NOT, here.

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