CodeIgniter Forums
Rewrite with lighttpd - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Rewrite with lighttpd (/showthread.php?tid=908)



Rewrite with lighttpd - mindphuk - 01-28-2015

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


RE: Rewrite with lighttpd - Rufnex - 01-28-2015

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


RE: Rewrite with lighttpd - mindphuk - 01-28-2015

(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


RE: Rewrite with lighttpd - Rufnex - 01-28-2015

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...


RE: Rewrite with lighttpd - CroNiX - 01-28-2015

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


RE: Rewrite with lighttpd - mindphuk - 01-29-2015

(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?


RE: Rewrite with lighttpd - mindphuk - 01-29-2015

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...


RE: Rewrite with lighttpd - Rufnex - 01-29-2015

Maybe you have to remap html to php in lighttpd?

http://www.cyberciti.biz/tips/lighttpd-map-html-pages-to-php-execute-html-pages-as-php.html


RE: Rewrite with lighttpd - Narf - 01-29-2015

(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 ...


RE: Rewrite with lighttpd - mindphuk - 01-30-2015

(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