I'm having trouble with enabling clean urls.

I have Drupal located in http://drupal.mydomain.com.

Process:

  • administer -> settings -> general settings -> Run the clean URL test
  • A page renders that without a theme style (no css). I select
  • I select "enable"
  • The style is gone on many administration pages, and the server times-out on many pages.
  • I called my hosting company. They recommended putting a php.ini file in each directory where I want mod_rewrite enabled/functioning. That didn't sound right.
  • I looked in .htaccess for instruction (after checking out the forums) and found this reference:
      # Modify the RewriteBase if you are using Drupal in a subdirectory and
      # the rewrite rules are not working properly.
      #RewriteBase /drupal
    

I'm a little lost on where to turn.

I've done all I can with the settings, and I don't know if the subdomain is the issue. If it is, I don't know where to go, or what to change.

Comments

anner’s picture

If you are using drupal in a subdirectory named /drupal, then you can just uncomment that line in the .htaccess file and give that a go.

weigang’s picture

before that,should make sure the host support .htaccess file,and php have installed the mod-rewrite module
_________________________________________________
I like 诛仙私服 and 螺旋藻

stefan_pn’s picture

Thanks a lot!

walkeroukor’s picture

I'll try that thanks

gollyg’s picture

There are two places where you need to tell drupal the base url of your site. One is in the settings.php file (from memory /sites/settings.php)
If you are going to work with clean urls you also may need to modify the htaccess file (this assumes you are using apache and the modrewrite is enabled on the server).

There is a line in the htaccess file that by default is commented - looks a little like

# RewriteBase /drupal

This is used for when your site is not at the root of your web server (quite common, particularly in development environments). You need to uncomment this line and change it to the root relative path to your site (for example if you type in localhost/drupal/mydrupalsite to view your site the rewrite base will be drupal/mydrupalsite).

Dont forget that, if you are transferring the site onto a remote server you will probably need different htaccess files for each server, as the baseurl may not be the same.

hth

Anonymous’s picture

1) settings.php

I opened setting.php located in sites/default and looked at the base url setting. Like I said, I have Drupal in a subdomain: http://drupal.mysite.com, so here's what the code looks like:

# $base_url = 'http://drupal.mysite.com';  // NO trailing slash!

Does the pound sign (#) serve as comment sytax? I checked the PHP online documentation, and found this:

<?php
   echo 'This is a test'; // This is a one-line c++ style comment
   /* This is a multi line comment
       yet another line of comment */
   echo 'This is yet another test';
   echo 'One Final Test'; # This is a one-line shell-style comment
?>

No reference to the pound sign (#); but I noticed that in the setting.php & .htaccess that the pound sign was used as a way to add comment, so I took the # out of that line of code $base_url = 'http://drupal.mysite.com'; // NO trailing slash!
and tried Run the clean URL test. No difference. Here's the error mesage:


Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@drupal.mysite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.37 Server at testsite.ouverson.com Port 80

2) .htaccess

Here's the original line of code:

  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  # RewriteBase /drupal

Here's what you recomended:

(for example if you type in localhost/drupal/mydrupalsite to view your site the rewrite base will be drupal/mydrupalsite).

So, I changed the code to this:

  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  RewriteBase /mysite/drupal

and...

  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  RewriteBase /drupal/mysite

and this!...

  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  RewriteBase /drupal

Same error message.

Not sure where I'm getting it wrong.

Thanks for the help.

===
Doug Ouverson
hear | see | say | do | teach

Anonymous’s picture

I tried the option with # in place, as I figured that PHP ignored # when it saw valid code (didn't know, but thought I'd try), and then ran Run the clean URL test. Same issues as before.

===
Doug Ouverson
hear | see | say | do | teach

gollyg’s picture

didnt read your initial post closely enought. The fact that you are running in a subdomain should mean that all of your paths resolve without an issue - I am running several sites on subdomains for testing purposes using clean urls and I find that the default settings work.

On my local machine I need to modify htaccess, but on the remote machine there is no problem.

From memory (I have had the style sheet problem before, where the home page kind of works and nothing else does) the style sheet problem relates to your base-url rather than the htaccess. Again, the base url should just be the subdomain address. You seem to have tried this and it doesnt work.

You could view your source code that is being generated on the pages that work (you may have to rollback your htaccess to the commented version). Sometimes this gives you clues as to how the base url is being handled, and why it cant find the styles etc. Look for the style sheet links in the head of the document and see if the path looks right.

let us know how you get on, and post a link if you want.

Anonymous’s picture

The process I went through (don't read just part of this comment)

1) changed .htaccess

* located in: public_html/mysubdomain

original:

  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # RewriteBase /drupal

after modification:

  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
RewriteBase /

==================

2) changed settings.php

* located in: public_html/mysubdomain/sites/default

original:

  # $base_url = 'http://mysubdomain.mydomain.com';  // NO trailing slash!

after modification:

$base_url = 'http://mysubdomain.mydomain.com';  // NO trailing slash!

That worked.

==================

3) swapped settings.php & .htaccess

I wasn't sure whether Clean URLs worked because of changes to both files, or just one of the files - so, I changed the settings.php back the way it was originally and left the modified .htaccess alone: the Clean URLs was still working properly; I disabled and then enabled - no problem.

The I did the opposite (left settings.php as before and changed .htaccess). The problems were the same as before.

In the end, the only file I changed was the settings.php:

$base_url = 'http://mysubdomain.mydomain.com';  // NO trailing slash!

Thanks to all who helped.

===
Doug Ouverson
hear | see | say | do | teach

Theo’s picture

Thanks so much Doug! I had been struggling with this problem for many hours until I just read your post. To get my subdomain working, I needed to modify both the .htaccess and settings.php file.

cheers,

-theo (http://www.uberjobs.com)

Anonymous’s picture

Glad to hear you got it working. It can be frustrating at times.

Best of success.

===
Doug Ouverson
hear | see | say | do | teach

sm00th’s picture

Hey guys,

IVe read thru the clean URL handbook section:http://drupal.org/node/15365,

I have shared hosting on aplus.net, and they do use Apache servers.

I have set up the website root as (Parking Location:) /offtr.com

I have followed the instructions, and have renamed .htaccess located in sites/all/modules/fckeditor2/editor/filemanager/connectors/py and placed the following command:

# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
RewriteBase /

and have tried

# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
RewriteBase /offtr.com

and have also tried

# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
RewriteBase /drupal

so on and so on.

I have also tried changing line 125 in the settings.php by taking the # away.

$base_url = 'http://www.offtr.com'; // NO trailing slash!

still no luck for me, always getting the same message: Your system configuration does not currently support this feature. The handbook page on Clean URLs has additional troubleshooting information.

I would appreciate it so much if somebody could please assist.

xjessie007’s picture

I had the same problem. My web worked fine on local. Then, when I ported my web to the hosting, the first page would work fine. When I clicked a link, the new page would open up blank or with internal error. I my case, just adding fwd slash after the RewriteBase, that is like this RewriteBase/, solved the problem.

---------------------------------
Everything you need to know: www.Maxi-Pedia.com

holeepassion’s picture

Been working over a day ...

Thank you !!!!

I thought I have to reinstall my website !!!

Merry Xmas to you indeed and a joyful New Year !!!

http://www.holeepassion.com

Positive actions for saving EARTH