LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-14-2013, 09:36 PM   #1
5883
Member
 
Registered: Aug 2004
Posts: 173

Rep: Reputation: 0
lighttpd redirect question


lighttpd 1.4.28 on emebdded board.

i'm newbie on this, i have a lighttpd.conf working.

based on that, want to make redirect to work,
each time i see C*.pl, want to redirect it to *.pl.
e.g. CfirstPage.pl => firstPage.pl

in the config file, i added 2 lines,
"mod_redirect", (in the server modules)
url.redirect = (
"^/(.*)" => "http://example.com/$1",
)

this is from
http://redmine.lighttpd.net/projects...wtoredirectwww

But not working, cannot even open the index.html.

any help appreciated !

Last edited by 5883; 04-14-2013 at 09:48 PM.
 
Old 04-15-2013, 01:44 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,841

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
just a question: did you replace example.com to your own hostname?
 
Old 04-15-2013, 03:16 AM   #3
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

You should use rewrite:
url.rewrite = ( "^/C(.+).pl" => "/$1.pl" )

Regards
 
Old 04-15-2013, 09:49 PM   #4
5883
Member
 
Registered: Aug 2004
Posts: 173

Original Poster
Rep: Reputation: 0
still says not available for
http://10.50.1.2/CCluster.pl

http://10.50.1.2/Status.pl
works fine.

i wonder if need to to sth. for that 10.50.1.2.

sorry asking dummy questions.
thanks for the help !


Quote:
Originally Posted by bathory View Post
Hi,

You should use rewrite:
url.rewrite = ( "^/C(.+).pl" => "/$1.pl" )

Regards
 
Old 04-16-2013, 12:29 AM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
still says not available for
http://10.50.1.2/CCluster.pl

http://10.50.1.2/Status.pl
works fine.
What you mean? That Status.pl gets rewritten as it should, while CCluster.pl doesn't


Quote:
i wonder if need to to sth. for that 10.50.1.2.
Don't get what you mean
 
Old 04-16-2013, 06:58 AM   #6
5883
Member
 
Registered: Aug 2004
Posts: 173

Original Poster
Rep: Reputation: 0
based on the suggestion you gave,

10.50.1.2/Status.pl can display correctly in the web,
10.50.1.2/CCluster.pl cannot display,

in my server, i have Status.pl, Cluster.pl


now my question is,
url.rewrite = ( "^/C(.+).pl" => "/$1.pl" )
will it process CCluster.pl, or 10.50.1.2/CCluster.pl

thanks !


Quote:
Originally Posted by bathory View Post
What you mean? That Status.pl gets rewritten as it should, while CCluster.pl doesn't


Don't get what you mean

Last edited by 5883; 04-16-2013 at 06:59 AM.
 
Old 04-16-2013, 08:17 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
now my question is,
url.rewrite = ( "^/C(.+).pl" => "/$1.pl" )
will it process CCluster.pl, or 10.50.1.2/CCluster.pl
It will rewrite the URI (i.e. everything after the "/") that starts with a capital "C" and end in .pl, regardless of the server IP
Please note, that with the above rule CCluster.pl will be rewritten twice resulting in luster.pl (maybe not what you want)
If you want to rewrite it once, so it reads Cluster.pl then you need:
Code:
url.rewrite-once = ( "^/C(.+).pl" => "/$1.pl" )
 
Old 04-17-2013, 10:26 PM   #8
5883
Member
 
Registered: Aug 2004
Posts: 173

Original Poster
Rep: Reputation: 0
still not working when i try
10.50.1.2/CStatus.pl, (10.50.1.2. is just a dummy ip i put here)
was hoping it can translate into Status.pl.

is it possible you take a quick look at my attached config file ?
if you can have time,
either way, appreciate your time !



Quote:
Originally Posted by bathory View Post
It will rewrite the URI (i.e. everything after the "/") that starts with a capital "C" and end in .pl, regardless of the server IP
Please note, that with the above rule CCluster.pl will be rewritten twice resulting in luster.pl (maybe not what you want)
If you want to rewrite it once, so it reads Cluster.pl then you need:
Code:
url.rewrite-once = ( "^/C(.+).pl" => "/$1.pl" )
Attached Files
File Type: txt lighttpd_conf.txt (5.2 KB, 28 views)
 
Old 04-17-2013, 11:58 PM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,841

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
your regexp is definitely not ok:
Code:
#### url handling modules (rewrite, redirect, access)
# url.rewrite                 = ( "^/$"             => "/server-status" )
#url.redirect                = ( "^/([a-zA-Z](.*)/(.pl)$" => "http://%1" )

#$HTTP["host"] =~ "^10\.(.*)$" {
url.redirect                = ( "^C/(.+).pl" => "/$1.pl" )
#}

# that would be better:
url.redirect                = ( "^/C(.+).pl" => "/$1.pl" )
# probably works....
 
1 members found this post helpful.
Old 04-18-2013, 02:04 AM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
is it possible you take a quick look at my attached config file ?
if you can have time,
either way, appreciate your time !
Didn't look further, as the first thing I saw is that you have mod_rewrite disabled.
You need to remove the "#" in front of it, so it reads
Code:
<snip>
            "mod_compress",
           "mod_rewrite",
           "mod_redirect",
<snip>
 
Old 04-18-2013, 05:58 PM   #11
5883
Member
 
Registered: Aug 2004
Posts: 173

Original Poster
Rep: Reputation: 0
working, many thanks !


Quote:
Originally Posted by pan64 View Post
your regexp is definitely not ok:
Code:
#### url handling modules (rewrite, redirect, access)
# url.rewrite                 = ( "^/$"             => "/server-status" )
#url.redirect                = ( "^/([a-zA-Z](.*)/(.pl)$" => "http://%1" )

#$HTTP["host"] =~ "^10\.(.*)$" {
url.redirect                = ( "^C/(.+).pl" => "/$1.pl" )
#}

# that would be better:
url.redirect                = ( "^/C(.+).pl" => "/$1.pl" )
# probably works....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
lighttpd - setup virtual hosting question satimis Linux - Server 26 04-14-2011 10:57 AM
HTTPS redirect question bates Linux - Server 3 10-07-2010 03:41 PM
Apache redirect question sir-lancealot Linux - Server 2 01-23-2008 09:42 AM
Simple redirect question? scsi.king Programming 3 04-24-2007 01:44 AM
apache redirect question twk Linux - Networking 2 10-23-2004 01:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration