Page 1 of 1

Any other options for subdirectory rewrite issue?

Posted: Fri Dec 12, 2008 4:16 am
by MarkMushakian
Hi folks..

I just finalized transferring my Serendipity install from it's original /Blog/ folder to my site root - to better integrate my blog with my site and it's links. I've spent quite a few days redesigning the template to get it just right - when, after finishing this evening, I noticed that access to my other folders was no longer allowed!

I came on here to find this post http://board.s9y.org/viewtopic.php?t=13896 and a couple of others on the subject - realizing it wasn't something I'd done wrong. Haha, I mean - I like to blog and all, but I don't want to see it in every directory I go to :wink:

I followed all of the options and ideas from that post
- adding .htaccess file to each folder
- altering main .htaccess
but to no avail.

Haha, I almost wanted to cry. What I'm asking (and desperately hoping for) is that there may be some other type of solution. I really don't want my blog in a separate directory anymore, and I wouldn't want my main index page to always be re-directed to /Blog/.

I'm sure you won't need to, but just in case, my site is here.. http://www.markmushakian.com/

Posted: Fri Dec 12, 2008 6:03 am
by judebert
Normally, putting an .htaccess in the subdirectory with the directive "RewriteEngine Off" will take care of the problem. However, you said you've already tried all the mentioned solutions, so I'm sure you've tried that.

Recently, I've been working with Don on a similar problem. We've been modifying the main .htaccess to stop rewriting subdirectories. After the "RewriteEngine On", but before the first "RewriteCond" or "RewriteRule", you add a line for each directory you want to stop rewriting in.

In your case that would be something like:

Code: Select all

RewriteRule ^Classics/ - [L,QSA]
RewriteRule ^Animation/ - [L,QSA]
RewriteRule ^MarkMukashian/ - [L,QSA]
What this says is: if the URL starts with my directory name, don't rewrite (that's the hyphen); this is the Last rule (that's the L), and if there's a Query String, Append it back to the URL (the QSA).

I'm sorry this has risen up to bite you. I know it's a pain to put all those directories in. Really, the "RewriteEngine Off" should do the trick; if we ever find out why it's not working, we'll do whatever we can to correct it.

Posted: Fri Dec 12, 2008 6:04 am
by Don Chambers
Mark -

I hate to be dense here, but what exactly is the problem?

I hit the link you provided, and the site comes up just fine, and is not redirected to a subfolder.....

Posted: Fri Dec 12, 2008 7:21 am
by MarkMushakian
@Don Chambers - Sorry for the confusion, my day has consisted of taking a college math test and staring at code, so I probably could have been more clear :wink: The problem is that all of my subdirectories are being rerouted to the main s9y index page.

@judebert - Thanks for the response. I honestly don't mind getting into it and fighting to get something to work.. haha, as long as it eventually does. I used your new suggestion, and still - it's not working. I'd love to find out that there is a silly error on my part, so here is my main .htaccess...

Code: Select all

RewriteEngine on
RewriteRule ^Classics/ - [L,QSA]
RewriteRule ^Animation/ - [L,QSA]
RewriteRule ^MarkMushakians/ - [L,QSA] 

rewritecond %{http_host} ^markmushakian.com [nc]
rewriterule ^(.*)$ http://www.markmushakian.com/$1 [r=301,nc]

# BEGIN s9y
DirectoryIndex /index.php

<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 only conditions I put in myself (besides your latest suggestion), are the two forcing www to appear before my domain name.

Also, in the name of trying to find the root cause of the problem, I'll mention, too, that I am currently hosting with GoDaddy, which I have sometimes heard cursed for being problematic, though I've never had an issue.

Posted: Fri Dec 12, 2008 12:02 pm
by garvinhicking
Hi!

The answer is quite easy. Your subdirectories do not specify their own indexfile, thus you must link to them like this:

http://www.markmushakian.com/Classics/index.html

The alternative is to put a .htaccess into each dir in which you set "DirectoryIndex index.html" to be able to use the URL without a filename.

Regards,
Garvin

Posted: Fri Dec 12, 2008 5:27 pm
by MarkMushakian
garvinhicking wrote:
The alternative is to put a .htaccess into each dir in which you set "DirectoryIndex index.html" to be able to use the URL without a filename.
Haha! That worked like a charm :D Both work, but I prefer the visual aspect of just using folder structure in the address bar, so I prefer that solution.

Thank you very much, Garvin - and judebert and Don Chambers for your time, as well.