Lighttpd redirect/ rewrite

lighttpdredirect

I am trying to setup a redirect/rewrite so that the urls end with / (trailing slash) (for making seo friendly).

However there are other internal rewrites, which are not shown in the browser address bar. I want to be able to redirect first with trailing / on the address
bar and then perform those internal rewrites.

when i try to put this rule at the start, all the internal rewrites get displayed in the address bar :

Currently i have rewrite rule :

`url.rewrite-once = (
^/([0-9_-]+)(?:\?(.*))?" => "/path/www/index.php?cmd=alias&target=$1&$2",
<second condition> => <relative uri>
<third condition> => <relative uri>
 )`

Here is the rule i wanted to add.

Rule used: url.redirect = ("^(.*[^/])$" => "$1/")

But this also shows my internal path on url.
e.g: www.tikejhya.com/path/www/index.php?cmd=alias&target=hellow/world&/

I just want to add a trailing slash ( in the address bar-visible) , leaving every thing else untouched.

FYI: my modules are in correct order too, i tried guglling (mod_rewrite/ fastcgi and alias with redirect)
Any pointers in the right direction would be highly appreciated.

Best Answer

Ok, I found a solution/ workout for this. As described before i had rewrite-once for all host, and i needed redirect which was showing up physical path.

After scratching my head hard, and reading all around over lightty posibility.

This will help you put path as a record

url.rewrite-once = (
    "^/show(.*)$"  => "$0"
)

Doing that upcoming step

This will help you redirect anything to holding path from above rewrite once and push you trailing / on the end.

url.redirect = (
    "^(.*[^/])$" => "$1/"
)