Welcome Guest, Not a member yet? Register   Sign In
Rewrite with lighttpd
#1

Hello.

I am just trying to get my rewrites running with lighttpd but I still get 404 when trying to access sitename.com/page.html

This is my apache rewrite that worked

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|css|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

This is my lighttpd config for the vhost for my internal testserver

Code:
# This is a minimal example config
# See /usr/share/doc/lighttpd
# and http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions

server.port        = 80
server.username        = "http"
server.groupname    = "http"
server.document-root    = "/srv/http"
server.errorlog        = "/var/log/lighttpd/error.log"

server.modules        += ("mod_fastcgi")
fastcgi.server        +=  (".php" => ((
                "bin-path" => "/usr/bin/php-cgi",
                "socket" => "/tmp/php.sock"
                ))
            )

dir-listing.activate    = "disable"
index-file.names    = ( "index.php" )
mimetype.assign        = (
                ".html" => "text/html",
                ".txt" => "text/plain",
                ".jpg" => "image/jpeg",
                ".png" => "image/png",
                ".css" => "text/css",
                #"" => "application/octet-stream"
            )

url.rewrite-once = (
    "/(css|images|js)/" => "$0",
    "^/([^.]+)$" => "/index.php/$1"
)

$HTTP["host"] =~ "hp.test.in" {
    server.document-root = "/srv/http/hp"
    server.errorlog = "/var/log/lighttpd/hp-error.log"
}

I also tried to have the rewrite rule inside $http["host"]...

What am I doing wrong? My lighttpd version is 1.4.35
Reply
#2

are you going to sitename.com/page.html ? I think you have to navigate to sitename.com/page

Reply
#3

(01-28-2015, 10:40 AM)Rufnex Wrote: are you going to sitename.com/page.html ? I think you have to navigate to sitename.com/page

It works with .html on apache
Reply
#4

maybe with apache the .html extension is configured to execute it as php but not in you lighttpd. But you dont answered if it work without the extension...

Reply
#5

Or maybe he has $config['url_suffix'] set to 'html'
Reply
#6

(01-28-2015, 12:44 PM)CroNiX Wrote: Or maybe he has $config['url_suffix'] set to 'html'

Yes I have the url suffix set to html because I wanted it to be .html

What extension would I need?
Reply
#7

Can someone please tell?

I need the links to be .html and I have config flag set to 'html', when I remove html from the links, it works, so somehow this flag is ignored...
Reply
#8

Maybe you have to remap html to php in lighttpd?

http://www.cyberciti.biz/tips/lighttpd-m...s-php.html

Reply
#9

(01-29-2015, 08:45 AM)mindphuk Wrote: Can someone please tell?

I need the links to be .html and I have config flag set to 'html', when I remove html from the links, it works, so somehow this flag is ignored...

Is that 'html' or '.html'? There's a slight difference ...
Reply
#10

(01-29-2015, 05:30 PM)Narf Wrote:
(01-29-2015, 08:45 AM)mindphuk Wrote: Can someone please tell?

I need the links to be .html and I have config flag set to 'html', when I remove html from the links, it works, so somehow this flag is ignored...

Is that 'html' or '.html'? There's a slight difference ...

Its the same setting that worked on apache, I didn't change the config.

I will try if its the remapping in lighttpd
Reply




Theme © iAndrew 2016 - Forum software by © MyBB