Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
By Seraph-1 on
I have Drupal installed to my root directory, and clean urls enabled with the following code in my .htaccess file
RewriteEngine on
# 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]
Yet it seems it is messing up my entire website, I tried putting .htaccess in my other folders with RewriteEngine Off but it's no use. I can't even log into my password protected sub directories as it fowards me to the drupal 404 page.
Comments
Have you tried this:
Have you tried this:
RewriteBase /
? (in its own line afterRewriteEngine on
- without the "?")~
Changed it to:
RewriteEngine on
RewriteBase /
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
RewriteBase /
# Rewrite old-style URLs of the form 'node.php?id=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^id=([^&]+)$
RewriteRule node.php index.php?q=node/view/%1 [L]
# Rewrite old-style URLs of the form 'module.php?mod=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
RewriteRule module.php index.php?q=%1 [L]
# 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]
No luck, still redircts to the drupal 404 page. :(
Change it back to
RewriteEngine on
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
#RewriteBase /
# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]
# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]
# 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]
And tell me, what do you exactly mean by "root directory" ? Provide the full path for it please.
I changed it, still having
I changed it, still having problems.
By root I mean this.
Drupal is installed in my root directory. mydomain.com/ and my forum is located at mydomain.com/talk and the control panel for my forum is at mydomain.com/talk/admincp/index.php
Whenever I go to access my control panel for my forum I am redirected to the the the 403 page for my drupal site.
I have .htaccess in my main directory for modrewrite, and .htaccess in my talk/admincp directory to prevent unauthorized access to my control panel. if I remove the .htaccess in my root directory I can view my control panel fine.
Full path?
/home/site/public_html/ <- Drupal
/home/site/public_html/talk/ <- Forum
/home/site/public_html/talk/admincp/ < - Forum Control Panel
Having same problem, this hack seems to work
RewriteEngine on
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
RewriteBase /
RewriteCond %{REQUEST_URI} ^/(^toolbox.*)$
RewriteRule ^(.*)$ $1 [L,QSA]
# 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]
---
Where toolbox is the name of the folder I want to be skipped. This is an ugly hack though. I'd much rather know why the default REQUEST_FILENAME conditions aren't working.
btw:
Operating system: Linux
Kernel version: 2.4.21-37.0.1.ELsmp
Machine Type: i686
Apache version: 1.3.34 (Unix)
PHP version: 4.4.1
MySQL version: 4.1.14-standard
It didn't work. :(
It didn't work. :(
Mod_rewrite and AllowOverride
Verify that your Apache has mod_rewrite module active and the directive AllowOverride All is set for the directory of your Drupal installation.
it stopped working
that's the weirdest thing. I had access to my sub directory for about an hour. then I lost it again. (I wonder if my web host caches .htaccess files or some weirdness. if so then it means one of the other things I tried was what worked, and now I've erased it in favor of the above garbage.)
Is there any way to check the "directive AllowOverride" is set to All if you don't have access to httpd.conf? Short of putting in a request to the support staff?
Is your installation of
Is your installation of drupal in
/home/site/public_html/
or
/home/site/public_html/drupal/
?
In other words - where are directories like "{path-to-drupal}/modules/" and "{path-to-drupal}/themes/" located?
And where is drupal's index.php file located (i.e., "/home/site/public_html/index.php" or "/home/site/public_html/drupal/index.php")?
It's in
It's in /home/site/public_html/ no /drupal/
It's in the root of my domain mydomain.com not mydomain.com/drupal
Hmmm...
Hmmm...
Well, if you also have /home/site/public_html/.htaccess - and mod_rewrite is available - then it seems like a simple modification to .htaccess would be all that's needed...
It sounds like your drupal installation works fine without Clean URLs, and that with Clean URLs on - you get a 404 error page generated by drupal - so drupal seems fine - except for this Clean URLs issue you're having...
If your web hosting provider has already confirmed that mod_rewrite is available to you - it seems like a minor variation (or no change) to the default .htaccess provided with drupal should do the trick...
Well, if you've tried the default .htaccess and know that mod_rewrite is available and working - it seems odd that Clean URLs are acting up... I recall having to fiddle with .htaccess a bit when I installed drupal the first time - I'm thinkin' the solution is close and we're just not seein' it...
Clean urls work fine, just
Clean urls work fine, just it effects it so I can't use htaccess to password protect my control panel for my forum.
What's the default file for
What's the default file for these other directories? index.html?
index.php
index.php
hmmm...
hmmm...
Well, if all non-drupal sub-directories have:
DirectoryIndex index.php
then I'm at a loss for more suggestions...
Otherwise, if some non-drupal sub-directories have index.html present - I was going to say to try:
DirectoryIndex index.php index.html
in /home/site/public_html/.htaccess - which allows a kind of pass-through to occur... if the sub-directory exists and if there is an index.html file present in the sub-directory...
*shrug* if that's not your case - and there are sub-directories with index.php in 'em - I can't say I can see from where the burp is coming...
fixed (for me anyway)
huge wrong post removed for brevity...
I think I fixed it. And it's so simple.
In perusing the logs I found this:
So I created a 401.shtml in my web root (with some valid html content). now I get the login prompt and everything works.
Notes.
* if you cancel or otherwise fail to log in the contents of 401.shtml will be displayed.
* the name of the file (401.shtml) might be different for you (it's up to your web host admin). So try logging in, then check the drupal admin page to see what file is missing.
* you might be able to change what file it looks for in your .htaccess file (to use a php file for instance). but I haven't tried it.
Thank you!!
Whew,
I've spent quite some time and various different techniques to try and get this to work and your suggestion does it! Thank you!!
:)
Alex
----------
Contract Web Development, Inc.
Worked for me
Thanks. Strange that a 401.shtml page was needed for it to work.
Jon
Bonus points
If you have subdirectories, this doesn't always work quite right, but putting ErrorDocument 401 "Unauthorized" - while less glam than an html file, worked better for me; as described in this thread: http://drupal.org/node/64708