I have installed drupal 6.22(fresh installation) on my localhost in which i have set user block on header. Now my problem is when i looked to action of user login form, here i can see my folder name is there.

Say My url : http://localhost/drupal6/

So i can find my form action : /drupal6/node/85?destination=node%2F85

Now after login my url becomes http://localhost/drupal6//drupal6/node/85?destination=node%2F85 and I got page not found error.

And that actually creates issue on redirection.

I want to mention that i have installed 6.22 cause we need to make changes to older version. TIA. What could be the actual reason? Do I need to create a custom user login block for the same? or any issue in url function though i have not changed core files or not added any custom login module. My active theme is garland.


Without login go to "http://localhost/drupal6/admin/settings/site-information", It shows access denied message then login using your account and you will face page not found error.

Cause in browser its showing me "http://localhost/drupal6//drupal6/admin/settings/site-information?destination=admin%2Fsettings%2Fsite-information".

Just try out in your any setup on localhost or on subdomain installation. Its not working as expected.

After login url should be "http://localhost/drupal6/admin/settings/site-information?destination=admin%2Fsettings%2Fsite-information" instead page not found. TIA

EDIT : MOD-Rewrite


4 Answers 4


Finally i found the issue of redirection. I have checked form.inc file from where i have found that drupal_goto function from common.inc file is called.

Now by debugging that form.inc i found that drupal_redirect_form calls drupal_goto with different options. In subfolder case (i.e. my case) drupal_goto function i have found that $path has value like '/drupal6/' default. So what i have hacked is

$folder_name = '/drupal6/';
$length = strlen($folder_name);
$path_check = substr($path,0,$length);
$path_len = strlen($path);
$remaining_path = '';

if($path_check == $folder_name) {   
    $remaining_path = substr($path,$length,$path_len);
    echo $path = $remaining_path;

So now my problem of adding two folder name like 'http://localhost/drupal6//drupal6/admin/settings/site-information?destination=admin%2Fsettings%2Fsite-information/' have been solved but as you know that this is core hack and i dont like it. Any better solution???

I know that if i transfer this site from my localhost to internet than that would not create any problem without making this kind of small hacks.


Modify line 94 of .htaccess to look like this:

RewriteBase /drupal6

Here are the contents of that file: http://drupalcode.org/project/drupal.git/blob/HEAD:/.htaccess

  • Tried your solution but does not make any affect. Facing the same issue of redirecting. Mar 30, 2012 at 6:13

I am not sure how you installed it, but would look into $base_url in your settings.php file (sites/default/settings.php) and see where it is pointing, and if drupal6 is not your actual web server root, then it should look something like


You can also look in admin/settings/site-information and make sure it is showing to the left of default front page, eg, it should look like this:

http://localhost:PORTNUMBER/drupal6 [ node ]


http://localhost:PORTNUMBER [ drupal6/node ]

  • I have tried your solution but doesn't make any difference. I tried "http"//localhost/drupal6" and on left of default front page its showing "localhost/drupal6". Also checked its not redirecting me properly on my page after login. ANyways thx. Mar 30, 2012 at 6:10
  • I want to inform you that in my settings.php file It showing me like this "#$base_url = 'example.com'; // NO trailing slash!", Its commented, So I changed it and added $base_url = 'localhost/drupal6'. My point is its by default commented. Mar 30, 2012 at 6:29
  • correct, by default drupal thinks it is in the web host root. if you change that to localhost/drupal6 then it will look there and prefix every path with that. it does this so if you move it to another host, you can just change this instead of every path inside drupal.
    – Jimajamma
    Mar 30, 2012 at 19:00
  • (and I just asked about the default home page in the off chance someone put in drupal6/node thinking that would change everything; glad that wasn't the case ;)
    – Jimajamma
    Mar 30, 2012 at 19:03
  • Thx for your info. Mar 31, 2012 at 6:17

Check line 107 in your .htaccess file. Try uncommenting that line, and ensure that line 103 is commented out.


  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  RewriteBase /

Also, just in case, ensure that you have mod_rewrite enabled on your localhost.

  • Please have a look at the updated question, i have attached my localhost phpinfo screenshot indicating mod_rewrite. After removing comment i got 404 error thats not handled by drupal itself. Not showing any page. "The requested URL /index.php was not found on this server." Apr 2, 2012 at 11:23
  • @Kamal What do you have in your settings.php file with regards to your $base_url (around line 125).
    – Chapabu
    Apr 2, 2012 at 11:31
  • Well actually its commented as "#$base_url = 'example.com'; // NO trailing slash!". Havent changed baseurl. Its pointing to localhost/drupal6 Apr 2, 2012 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.