Page 1 of 1

Mod_Rewrite Help

Posted: Fri Jul 31, 2009 11:53 pm
by Maccsta
Hi!

I need to exclude a folder & 4 html pages from the mod_rewrite rules:

http://www.mydomain.com/galleries/

http://www.mydomain.com/page_one.html

What do I need to add and where in the htacces file?

Any help is greatly appreciated. Thanks In advance :)

James.




# BEGIN s9y
ErrorDocument 404 /index.php
DirectoryIndex /index.php
php_value session.use_trans_sid 0
php_value register_globals off

RewriteEngine On
RewriteBase /
RewriteRule ^serendipity_admin.php serendipity_admin.php [NC,L,QSA]
RewriteRule ^((([0-9]+)/[0-9a-z\.\_!;,\+\-\%]+/)/?) index.php?/$1 [NC,L,QSA]
RewriteRule ^(authors/([0-9]+)-[0-9a-z\.\_!;,\+\-\%]+) index.php?/$1 [NC,L,QSA]
RewriteRule ^(feeds/categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-\%]+\.rss) index.php?/$1 [NC,L,QSA]
RewriteRule ^(feeds/authors/([0-9]+)-[0-9a-z\.\_!;,\+\-\%]+\.rss) index.php?/$1 [NC,L,QSA]
RewriteRule ^(([0-9;]+)-[0-9a-z\.\_!;,\+\-\%]+) index.php?/$1 [NC,L,QSA]
RewriteRule ^archives([/A-Za-z0-9]+)\.html index.php?url=/archives/$1.html [NC,L,QSA]
RewriteRule ^([0-9]+)[_\-][0-9a-z_\-]*\.html index.php?url=$1-article.html [L,NC,QSA]
RewriteRule ^feeds/(.*) index.php?url=/feeds/$1 [L,QSA]
RewriteRule ^unsubscribe/(.*)/([0-9]+) index.php?url=/unsubscribe/$1/$2 [L,QSA]
RewriteRule ^approve/(.*)/(.*)/([0-9]+) index.php?url=approve/$1/$2/$3 [L,QSA]
RewriteRule ^delete/(.*)/(.*)/([0-9]+) index.php?url=delete/$1/$2/$3 [L,QSA]
RewriteRule ^(admin|entries)(/.+)? index.php?url=admin/ [L,QSA]
RewriteRule ^archive/? index.php?url=/archive [L,QSA]
RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml) rss.php?file=$1&ext=$2
RewriteRule ^(plugin|plugin)/(.*) index.php?url=$1/$2 [L,QSA]
RewriteRule ^search/(.*) index.php?url=/search/$1 [L,QSA]
RewriteRule ^comments/(.*) index.php?url=/comments/$1 [L,QSA]
RewriteRule ^(serendipity\.css|serendipity_admin\.css) index.php?url=/$1 [L,QSA]
RewriteRule ^index\.(html?|php.+) index.php?url=index.html [L,QSA]
RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
#RewriteCond %{REQUEST_URI} !-U
RewriteRule (.*\.html?) index.php?url=/$1 [L,QSA]

<Files *.tpl.php>
deny from all
</Files>

<Files *.tpl>
deny from all
</Files>

<Files *.sql>
deny from all
</Files>

<Files *.inc.php>
deny from all
</Files>

<Files *.db>
deny from all
</Files>

# END s9y

Re: Mod_Rewrite Help

Posted: Sat Aug 01, 2009 3:05 am
by Don Chambers
I really stink at this stuff, but let me see if I can help.....

For folders, simply create a .htaccess file in THAT folder with the following line:

Code: Select all

RewriteEngine Off
To allow access to files in your root folder, add this to your existing root .htaccess file:

Code: Select all

RewriteRule ^page_one.html - [L]

Re: Mod_Rewrite Help

Posted: Sat Aug 01, 2009 3:01 pm
by Maccsta
Thanks Don! The folder solutions works great but for some reason the code I added to the .htaccess file didn't.

So I just put the 4 pages in another folder to make things easy!

Thanks again.