Project

General

Profile

[Solved] Using mod_rewrite to redirect traffic to index.html in subfolder

Added by kkoych over 3 years ago

Hello,

I am using lighttpd to serve my personal projects and I'm using a subfolder structure, e.g. XX.XX.XX.XX/project-folder/index.html
I need a way to rewrite all the traffic to /project-folder to go to index.html.
I tried to do
url.rewrite = (
"^/kendo-angular/([^?]*/)(\?.*)?$" => "/kendo-angular$1index.html$2"
)

but nothing seems to happen.


Replies (2)

RE: Using mod_rewrite to redirect traffic to index.html in subfolder - Added by gstrauss over 3 years ago

That rewrite rule does exactly what you told it to do, but it is apparently not what you want, and the result is probably missing a '/' between "/kendo-angular" and the rest.
Why don't you try to post here a list of a few examples of full URLs that you get, and the full URLs you want to see as a result?

Here's a guess:
url.rewrite-once = ( "^/kendo-angular(.*)" => "/kendo-angular/index.html$1" )
See mod_rewrite

RE: Using mod_rewrite to redirect traffic to index.html in subfolder - Added by kkoych over 3 years ago

It seems using the code you posted has fixed it for me. Now everything is working as expected, thank you.

    (1-2/2)