A customer is replacing their old perl based site with a newly written php based (using codeigniter framework). They would very much like the old page accessible for google indexing/rank/seo. The old sites index.cgi redirect to /se/index.cgi, so this means that all request for the old site will have /se/*.cgi (plus additionally /cmn/ for static content).
I have setup both sites in lighttpd, and they do work individually. In the config of the new site, I have created aliases for index.cgi|/se/|/cmn. The new site requires rewriting of: * to index.php?\*, this can be done with
"^(\.*)$" => "/index.php?/$1".
Using the first version of test.example.com, the new page behaves as expected.
The request against /search works (which rewrites to /index.php?search).
However, accessing .cgi|/cmn|/se does not work - instead I get a codeIgniter generated 404.
Using the second version of test.example.com, the old site is accessible through test.example.com/se/index.cgi, and the new page's /index.php - BUT /search is not rewritten to /index.php?search. In fact, the 404 is the standard lighttpd 404 so this leads me to believe that it's old.example.com's 404..
Seems very simple to solve if one knows his regexp, which I obviously do not. Can anyone spot the problem?
$HTTP["host"] =~ "old\.example\.com$" {
server.document-root = "/home/example/perl/web"
server.errorlog = "/var/log/lighttpd/lgold_error.log"
accesslog.filename = "/var/log/lighttpd/lgold_access.log"
}
# new page works, old page through rewrite does not.
$HTTP["host"] =~ "(^www|^test)\.example\.com$" {
server.document-root = "/home/example/php"
server.errorlog = "/var/log/example/example_error.log"
accesslog.filename = "/var/log/lighttpd/example_access.log"
alias.url += (
"/index.cgi" => "/home/example/perl/web/index.cgi",
"/se" => "/home/example/perl/web/se",
"/cmn/" => "/home/example/perl/web/cmn/",
)
url.rewrite-once = (
".*\.(js|ico|gif|jpg|png|swf|css|html)$" => "$0",
"^(.*)$" => "/index.php?/$1",
)
}
# Old page works through test.somehost.com/se/index.cgi, only /index.php works on new page, and not /some-url-here
# (which really is /index.php?some-url-here)
$HTTP["host"] =~ "(^www|^test)\.example\.com$" {
server.document-root = "/home/example/php"
server.errorlog = "/var/log/example/example_error.log"
accesslog.filename = "/var/log/lighttpd/example_access.log"
alias.url += (
"/index.cgi" => "/home/example/perl/web/index.cgi",
"/se" => "/home/example/perl/web/se",
"/cmn/" => "/home/example/perl/web/cmn/",
)
url.rewrite-once = (
".*\.(js|ico|gif|jpg|png|swf|css|html)$" => "$0",
# rewrite all requests BUT ^/cmn/, ^/se/ and ^\*.cgi to index.php?$1
"!(^/cmn|^/se|*\.cgi)" => "/index.php/$1",
)
}