0

In order to enable clean urls in Drupal, I add the lines below to the lighttpd configuration file.

However I'm now working on a local server and I don't have a domain available. So I need to work with this address 192.168.75.159:81/Sites/drupal/

I've tried to replace ["host"] with ["socket"] and replace the domain with ip and subfolders (see address above), but unsuccessfully. How can I set the configuration file to set clean urls even if I don't have a domain ?

thanks

$HTTP["host"] =~ "(^|\.)mywebsite\.com" {
  server.document-root = "/var/www/sites/mywebsite"
  server.errorlog = "/var/log/lighttpd/mywebsite/error.log"
  server.name = "mywebsite.com"
  accesslog.filename = "/var/log/lighttpd/mywebsite/access.log"
  include_shell "./drupal-lua-conf.sh mywebsite.com"

  url.access-deny += ( "~", ".inc", ".engine", ".install", ".info",
       ".module", ".sh", "sql", ".theme",
       ".tpl.php", ".xtmpl", "Entries",
       "Repository", "Root" )


  # "Fix" for Drupal SA-2006-006, requires lighttpd 1.4.13 or above
  # Only serve .php files of the drupal base directory
  $HTTP["url"] =~ "^/.*/.*\.php$" {
      fastcgi.server = ()
      url.access-deny = ("")
  }

  magnet.attract-physical-path-to = ("/etc/lighttpd/drupal-lua-scripts/p-.lua")

}
1

I don't know what OS you are using but you can add a line to /etc/hosts on *nix systems and c:\Windows\System32\Drivers\etc\hosts that allow you to map mywebsite.com (or dev.mywebsite.com) to 127.0.0.1.

Or a better idea would be if you are in control of DNS just create a subdomain A record like dev.mywebsite.com and point it to 127.0.0.1.

| improve this answer | |
  • Not sure my question was clear. I've actually done what you wrote but it doesn't work. I've replaced $HTTP["host"] =~ "(^|\.)mywebsite\.com" with $HTTP["host"] =~ "192.168.75.159:81/Sites/drupal/" – aneuryzm Dec 27 '10 at 15:58
  • I don't think you understand my response, what you would do is "trick" your computer into using a hostname but point the hostname wherever you want. So, I think instead of 127.0.0.1 you probably want 192.168.75.159. And even if you put the record into DNS - it doesn't mean that other people will be able to access it, which I think is the easiest way. – Natalie Adams Jan 2 '11 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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