This is a discussion on redirect to www in lighttpd within the Web servers forums, part of the Mastering Servers category; I tried this on my lighttpd.conf as stated in the tutorial but I can still access the mydomain.com (no www) ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
I tried this on my lighttpd.conf as stated in the tutorial but I can still access the mydomain.com (no www) URL
Code:
$HTTP["host"] == "^mydomain\.com$" {
server.document-root = "/home/mydomain/www"
server.errorlog = "/var/log/lighttpd/mydomain.com/error.log"
accesslog.filename = "/var/log/lighttpd/mydomain.com/access.log"
url.redirect = ( "^/(.*)" => "http://www.mydomain.com/$1" )
}
I've also activated the mod_redirect module any ideas? |
| Sponsored Links | ||
|
|
|
||||
|
Replace
Code:
url.redirect = ( "^/(.*)" => "http://www.mydomain.com/$1" ) Code:
$HTTP["host"] =~ "^www\.(.*)" { url.redirect = ( "^/(.*)" => "http://%1/$1" ) }
|
|
|||
|
thanks for the reply
but I want the other way around I want users who type http://cricketnow.in/ will be redirected to http://www.cricketnow.in/ |
|
|||
|
Hi,
The redirect doesn't work in my wordpress. when I type domain.com/date/day/post, it redirects me to www.domain.com/index.php/date/day/post, thus it gives me a 404 error. I think this is due to my rewrite rule that I Have.. but I have no idea how to fix it. I am currently running my wordpress on lighttpd. Here is my rewrite rule: url.rewrite = ( "^/(wp-.+).*/?" => "$0", "^/(sitemap.xml)" => "$0", "^/(xmlrpc.php)" => "$0", "^/(news-sitemap.php)" => "$0", "^/(google_adsense_script.htm)" => "$0", "^(/(images|img|jcap|photo /.*)$" => "$1","^/(.+)/?$" => "/index.php/$1" ) Does anyone know how to fix it? I need to get this done asap, because google is reading doubt post (www.domain.com and domain.com) Thanks in advance, Calvin |
|
||||
|
Hi,
For domain.com/index.php/slug/.. you don't need url.rewrite For wp seo clean urls: Code:
server.error-handler-404 = "/index.php?error=404" Code:
$HTTP["host"] =~ "^cyberciti\.biz$" { url.redirect = ( "^/(.*)" => "http://www.cyberciti.biz/$1" ) }
|
|
|||
|
hmm.. doesn't seem like it is working..
the redirect works if it was just simply domain.com. But when I try to go to domain.com/slug/post. it redirects me to www.domain.com/index.php/slug/post, which doesn't exist, but www.domain.com/slug/post works. soo same problem still.. Calvin |
|
||||
|
U need only 2 lines as pointed out by vivek, remove your rest of the junk (your mod_rewrite seo code) , here is code from one my own domain:
Code:
server.document-root = "/home/lighttpd/domain.com/http"
accesslog.filename = "/var/log/lighttpd/domain.com/access.log"
# WP seo urls
server.error-handler-404 = "/index.php?error=404"
# feedburner redirect
$HTTP["useragent"] !~ "FeedBurner" {
url.redirect = (
"^/feed*" => "http://feeds.feedburner.com/myUrl",
"^/\?feed=*" => "http://feeds.feedburner.com/myUrl"
)
}
# redirect all domain.com/2005/01/url/ to www.domain.com/2005/01/url/
# send 301
$HTTP["host"] =~ "^domain\.com$" { url.redirect = ( "^/(.*)" => "http://www.domain.com/$1" ) }
__________________
Rocky Jr. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
|
|||
|
Quote:
On a related note you can use google site ( http://www.google.com/webmasters/sitemaps/ ) to force to use www.domain.com or domain.com only while indexing your blog. You can set your preferred domain in google sitemaps. Chk this out: Webmaster Help Center - What's a preferred domain? Can you show us your blog url (if you don't have any problem) ? Babai |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Apache Redirect / to index.php using mod_rewrite .htaccess | kasimani | Web servers | 1 | 04-18-2008 11:17 PM |
| Apache and lighttpd together | anjanesh | Web servers | 4 | 08-29-2007 05:11 PM |
| Redirect + Rewrite Problem in Lighttpd | Lizard King | Web servers | 4 | 07-17-2007 09:44 AM |
| How to redirect Output | puppen | Shell scripting | 15 | 12-06-2006 08:44 PM |
| How can I redirect the output of time command to file | warren | Linux software | 13 | 08-25-2006 11:17 AM |