htaccess conflict

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

htaccess conflict

Post by Don Chambers »

I am testing another php script in a folder under serendipity. My s9y htaccess is the standard written when using mod rewrite;

Code: Select all

# BEGIN s9y
ErrorDocument 404 /index.php
DirectoryIndex /index.php

RewriteEngine On
RewriteBase /
RewriteRule ^serendipity_admin.php serendipity_admin.php [NC,L,QSA]
RewriteRule ^((archives/([0-9]+)\-[0-9a-z\.\_!;,\+\-\%]+\.html)/?) 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 ^(categories/([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
The script I am testing came with its own .htaccess file as follows:

Code: Select all

Options +FollowSymLinks

RewriteEngine on
RewriteBase /classtest/admin

RewriteCond %{REQUEST_URI} (/|\.htm|\.html|/[^.]*)$  [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^rss([0-9]{0,}),(.*).html$ rss.php?cat=$1 [L]
RewriteRule (.*) index.php?page=$1
RewriteRule templates\/(.*).tpl$ index.php[F]
RewriteRule templates_c\/(.*) index.php[F]
RewriteRule configs\/(.*).conf$ index.php [F]
#RewriteRule ^p-(.*).html$ index.php?page=$1 [L]
When I call mysite.com/classtest/admin, I am redirected back to mysite/serendipity-admin.php. I tried adding DirectoryIndex /index.php to this other htaccess file, as it too has index.php as the index file name, but that didn't work. I rarely mess around with htaccess files and rewrite rules, so what am I missing here? I want to load mysite.com/classtest/admin/index.php if I browse to mysite.com/classtest/admin.
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: htaccess conflict

Post by garvinhicking »

Hi!

RewriteRules are passed on to each subdirectory, and are executed starting from the base directory. This usually mostly always conflicst.

You can only try to install your app parallelyto s9y, not inside of s9y. I don't think you can override the s9y rewriterules inside a subdirectory.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: htaccess conflict

Post by Don Chambers »

I know subfolders inherit, but isn't there a way to tell s9y's htaccess to ignore an entire folder? I tried this in the s9y htaccess, but it didn't work:

Code: Select all

RewriteRule ^/classtest - [L]
But it didn't work.
=Don=
kleinerChemiker
Regular
Posts: 765
Joined: Tue Oct 17, 2006 2:36 pm
Location: Vienna/Austria
Contact:

Re: htaccess conflict

Post by kleinerChemiker »

Which might work (didn't test anything like that) is that you turn off the rewriteengine in "/classtest" an back on in "/classtest/admin". Maybe turning it off stopps passing on the rules.
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: htaccess conflict

Post by Don Chambers »

kleinerChemiker wrote:Which might work (didn't test anything like that) is that you turn off the rewriteengine in "/classtest" an back on in "/classtest/admin". Maybe turning it off stopps passing on the rules.
Turning off rewrite is not an option, the /classtest folder ALSO has an index.php, and I need a way for it to understand that each of these folders has their own directory index.php files if just the folder is accessed.
=Don=
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: htaccess conflict

Post by Timbalu »

Why don't you put the classname htaccess entries inside a <Directory .../> container of serendipity htaccess. Then Serendipity knows this folder has special rules.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
amellymerry
Posts: 1
Joined: Thu Oct 28, 2010 10:23 pm
Location: Newark, New Jersey, USA
Contact:

Re: htaccess conflict

Post by amellymerry »

I have htaccess file named htaccess.txt tried several time to rename it as .htaccess but windows showing same error for right extension. Are there any solution for it?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: htaccess conflict

Post by garvinhicking »

Hi!
amellymerry wrote:I have htaccess file named htaccess.txt tried several time to rename it as
.htaccess but windows showing same error for right extension. Are there any solution for it?
Which error?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: htaccess conflict

Post by Timbalu »

Filename: .htaccess
Save as All types (*.*) !!!
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Post Reply