I am converting a site from a "roll your own" asp site so I've lots of 301 re-writes to do have found some help on that - but I may be back ;)
first though I have an existing subdirectory /demos/
the content and pages within that existing subdirectory are to remain intact - as in it's not getting put into Drupal that's working fine so far, (drupal is bypassing index.php if the directory exists?)
However that subdirectory would've had a default.asp page as it's index and I *would* like to put the index page into Drupal as a node/page and have it called the same thing as it was previously - /demos
I've created the page and specified its URL alias - but it's still going to the directory so I'm getting the forbidden message - How do I tell Drupal to use it's index.php just for the index page of an existing subdirectory (is that even the right question ;)) I'm fairly newish to both .htaccess and Drupal
TIA
Comments
See the last rewrite rule in
See the last rewrite rule in the default Drupal .htaccess file:
It basically means that anything that does not map to a "real" file (the first RewriteCond) or to a "real" directory (the second RewriteCond) is passed to the Drupal index.php, and we stop rewriting (the L parameter).
One way to explain your goal is that we want the /demos/ path to be passed to Drupal regardless of it being a file or a directory. We can achieve this by adding the following RewriteCond to trigger another Drupal Rewrite Rule before the original one:
Notice that we use REQUEST_URI in our RewriteCond because we do not care which file it translates to.
You could also achieve the same goal writing a more complicated set of RewriteCond lines to add to the original RewriteRule, but I think the solution above is easier to visualize. See: http://httpd.apache.org/docs/2.1/mod/mod_rewrite.html#rewritecond
Please, let us know how it turns out.
Thank YOU!
that was just the ticket.. as was your explanation
I'd looked at another thread explaining this rule and I couldn't get it ;)
http://drupal.org/node/30334
so REQUEST_URI = exact match for path (with trailing slash if index page) ?
this is actually going to help me even more as I had a couple other existing paths which I was trying to workaround by renaming or making sure I didn't use them as category names - now it shouldn't matter as long as I remember to put in one of these rules
Many thanks again for your explanation
Suzy
Wow. I'm barred by the programmer lingo. Come on, guys.
I'm just writing to say I give up on this whole concept of rewriting my URL. Ever. Here's why:
There is one tool to get this job done + I cannot understand the tool = I will never understand or be able to implement that tool.
I'm actually quite an accomplished beginning programmer, so I move easily between computer languages fairly easily. Don't much care what language I'm swimming in. When speaking to human beings, I try to speak in a human language out of courtesy to them. That way, they know what I'm saying to them. That means if I use jargon, I assume any technical word I use is alien to them.
The code here makes logical sense to the machine. For humans, the explanation seems to be missing a glossary.
The following is a list of the unexplained jargon used above that I actually understood:
"One way to explain you" [I'm sorry. I don't really understand in what sense you mean "explain" or to whom]
"because we do not care which file" [with you on that phrase]
"Notice that we use" [right on]
# --- have to assume that's for comments in this sub-language. What language? Dunno.
{ } --- seen em.. Even know what those do.
write --- gotcha
rule ---- right on... filter must have rules.
index.php --- hell, I could even point at this file on a map of the world!
But that's about it. You guys keep writing alien nonsense that keeps me out of your club. Have fun with your exclusive club. Rather than TRY to seek to understand what I'm looking at and spending about 4 and a half hours tracking down equally obscure definitions of each of the remaining terms, and hitting the upload button to my ftp server and the refesh on my browser (saving the file and seeing if fiddling with it worked) for the rest of the night, I have resigned myself to overpaying a professional to fix it if ever becomes an issue.
"we do not care which file it translates to"
uh... why not?
A background of understanding every single argument is merely assumed. Understanding
# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Do you know how I felt when I saw this? Where do I put this block of code? I assume it goes in my .htaccess file because nowhere have I been told otherwise.
"writing a more complicated set"
I have never seen anything more complicated.
In case anyone is moved enough to still want to help me, all I want to do is change this:
http://www.website.com/unneccessary/good/good/stillgood/index.html
to this:
http://www.website.com/good/good/stillgood/index.html
But like I say, I've given up.
unnecessary = drupal
Shouldn't there be a standard .htaccess file for self-important busy idiots I can download and just plug it in? Post that link and I'll be your best friend.
No, I DON'T know what version of Apache my webhost uses. :P
Roger Abramson
_
April fool's day was 2 days ago.
What would be the RewriteBase
What would be the RewriteBase for this?
RewriteBase /drupal
or
RewriteBase /
or
entirely missing?
Having a Very Similar Issue!
Tried using the code you gave to solve the issue but doesn't seam to be helping.
My page is coming up file not found when this line is used.
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
So I put you code to work below, but it still didn't help.
Any help is apprecaiated, class coming up that I need to get this done for Ugh!
Thanks!
peace
Same here. Page Not Found
Same here. Page Not Found error. If I use /index.php it works.