Wednesday, January 26, 2011

What is wrong with my .Htaccess file? I'm trying to redirect permanently my whole site to the index.htm file

This is giving me a 500 internal server error. Any suggestions? I have tried various examples but I think I'm missing something...

RewriteEngine On
RewriteCond  %{request_uri}!^ /index\.htm
RewriteRule  ^(.*) /index\.htm [R=permanent,L]

It displays the homepage if I navigate there but anything that meets the conditions (all appart from index.htm gives the server 500)

EDIT: with the above code it now doesnt give any 500 errors but it doesnt redirect for any pages

  • You're not redirecting to /index.htm, you're redirecting to / which is different as far as Apache is concerned.

    Try: RewriteRule ^(.*)$ /index.htm [R=permanent,L]

    SocialAddict : please can you edit out the domain - i forgot :)
    SocialAddict : Incidently I tried that just before your post with the same issue :(
    SocialAddict : I'm using utf-8 as the .htaccess file type is that correct?
    SocialAddict : still doesn't redirect but displays the original (old) page
    Andy Shellam : What about capitalising REQUEST_URI? It might be case-sensitive, and in all the Apache documentation, those macros ARE IN CAPS (not shouting, just illustrating :-P )
    SocialAddict : tried that now too no luck
  • Your rewrite condition isn't split up well and your Not-StartWith is part of the previous parameter. :) You need a space after the %{REQUEST_URL} and before the !^

    RewriteEngine On
    RewriteCond  %{REQUEST_URI} !^/index\.htm$
    RewriteRule  ^(.*) /index.htm [R=permanent,L]
    
    From Amadiere

Recommendation for a non-standard SSL port

Hey guys,

On our server I have a single IP, and need to host 2 different SSL sites. Sites have different owners so have different SSL certificates, and can't share the same certificate with SAN.

So as a last resort I have modified the web application to give the ability to use a specified port for secure pages. For its simple look I used port 200. However I'm worried about some visitors may be unable to see the site because of their firewalls / proxies blocking the port for ssl connections. I heard some people were unable to see the website, a home user and someone from an enterprise company, don't know if this was the reason.

So, any recommendations for a non-standard SSL port number (443 is used by the other site) which may work for visitors better than port 200 ? Like 8080 or 8443 perhaps?

Thanks!

  • Using port 200 would definitely be an issue. My users wouldn't be able to see your site on that port.

    8443 is a good compromise. Being standard in Java environments, more professional environments will allow it. I suspect there will still be issues, however.

    SuperDuck : Ah great tip, thanks Warner. Yeah there may always be some issues, but at least it will give a better chance then. I heard the bank, who will check the website for virtual pos application was unable to access the site. Though I'm not sure if this was the problem, I'll try my chance with 8443 =)
    SuperDuck : great! just remembered we had some spare IPs, waiting for the support to adjust the firewall.
    From Warner
  • I present Server Name Indication over SSL. With this, you can have apache listen on one IP:port and browsers will send you the hostname before initiating SSL. All modern browsers support this, unless you're enslaved by IE6 for some reason.

    SuperDuck : thanks for your comment, jldugger. sni was my second hope, as we dropped the support for ie6. however I've noticed that it won't work for XP systems, even if you use the latest IE version. So I guess it needs at least 4 5 years to become usable.
    From jldugger

Does Gigabit degrade all ports to 100 megabit if there is a 100 megabit device attached?

Our company is buying some HP Procurve managed gigabit switches to replace some of our core switches. However, we aren't able to upgrade all of our switches from 100Mb to Gigabit switches. I think I know the answer but I'm not exactly sure. If we plug those 100Mb switches (or even a 100Mb device) into those Gigabit switches, will the performance of the entire switch drop to 100Mb or will just that one port work at 100Mb?

  • Just that port.

    hjoelr : Great! That's how I thought it worked, but just wanted to make sure.
    From mfinni
  • If you can avoid cascading switches, I'd strongly encourage it. The downsides are easily exampled with two people on the same cascaded switch copying a large file to a fileserver. Having a single user under normal usage being able to cause usage issues for multiple other users is obviously bad.

    Implications are even worse with servers.

    hjoelr : Yea, I totally agree with you. We are planning on removing the cascade switches when we get a chance to completely re-wire our 40-year-old building.
    David Spillett : Many Gbit switches have FP ports that would allow you to install ports to link between then, reducing (but by no means removing) the potential performance problems with cascaded switches by providing a faster (10Gbit) backbone for them to talk over. The fiber modules and related kit may be prohibitively expensive for you at the moment, but it might be worth getting switches that support this for future proofing.
    From Warner

Test a site with a static subdomain locally

How can I test a site that uses one or more static domains for serving images locally?

e.g.

  • domain.tld with images servered from static.domain.tld
  • Local working copy of the site on WAMP checked out from SVN: URLs will be pointing at static.domain.tld rather than static.domain.local
  • I'm not exactly sure what you're asking, but you could always put entries in your hosts file if it's a question of resolving static.domain.tld, domain.tld, etc.

    %systemroot%\system32\drivers\etc\hosts:
    
    static.domain.tld   127.0.0.1
    someotherstatic.domain.tld   127.0.0.1
    
    From gravyface

Where to get the NT option pack

Hi,

Where do I get the NT option Pack? All the download links I could find are down... Does somebody know where I can still find it? I have access to MSDNAA, but I couldn't find anything there...

Thanks! Yvan

  • Any reason you don't move to a newer version of Windows instead? Was this NT 4 or 3.51? It's been a LONG time since anyone referred to the NT Option Pack..

    Steve Radich-BitShop.com : Unless you are running ISAPI routines the upgrade all the way to IIS 7.5 (Win 2008 R2) shouldn't be too bad - The main differences are security options that the default values changed - Classic ASP hasn't changed all that much over the years if that's what you are using. I don't know if idc/htx files are still supported, that may be the only true "missing" feature from the oldest IIS.

Output the number of cores and speed of a server?

I have access to another college's standalone server and am running several experiments on it. However, I don't know how many cores or the speed of the cores in the machine. Is there a way to get that information through the command line? Right now I'm accessing it through SSH.

  • cat /proc/cpuinfo
    
    tylerl : You beat me to it.
    John Gardeniers : That's assuming it's a *nix system.
    Dennis Williamson : ...that uses the `/proc` filesystem.

An alias (defined as a hosts entry) for a fileserver works only when it is a win2008-box, why?

On a Terminalserver (win2008), we like to have an alias for the real fileservername and therefor we put a line in hosts like:

  • 192.168.0.10 BigFiler

This only works fine for Fileserver under windows 2008 not for win2003-servers, why?

We do not have defined a CNAME alias that is created in the DNS zone!

  • Without more details in your question, I'm assuming you have this issue:

    http://support.microsoft.com/kb/281308

    Which basically means that the W2K3 server isn't listening for requests to the alias name.

    Ice : We do not have defined a CNAME alias that is created in the DNS zone! There is only a hosts entry on the client computer from were we want to access the fileserver. The kb281308 doesn't apply to this issue, i think.
    joeqwerty : It does. It doesn't matter whether you have a CNAME record in your DNS zone or an entry in your hosts file. The file server doesn't know that it should respond to the name in the hosts file. 1. The file server has a computer name, let's call it Filer. 2. On the terminal server you have an entry for Filer called BigFiler. 3. Filer doesn't respond to the name BigFiler because it doesn't know that it should. 4. Follow the KB article to make Filer listen for requests to the name BigFiler. 5. Test.
    Ice : ok, but the terminalserver converts any access to BigFiler to the IP-Address of Filer as defined in his hosts-file, or not?
    joeqwerty : At the network layer yes, but at the application layer the request is still going to the "alias" name, which the server won't respond to, unless you follow the steps in the KB.
    From joeqwerty