Technology TidBits

Answers to various technical questions on php programming, mysql, linux, and many more categories.
25% off Hosting at HostGator.com:
Use Code techbits25



Showing: 1-15 of 15  
Questions:
How can I rewrite / redirect URLs using apache and mod_rewrite?
Set up an .htaccess file with lines like this: RewriteEngine OnRewriteRule .html$ redirect.php This will redirect all *.html files to a file...
06/29/2009 Comments: 0
How do I password protect a directory on my website?
Create a file in the protected directory called .htaccess (leading . is important)In that file, put these lines: AuthName "Section...
06/24/2009 Comments: 0
How do I turn off my website for maintenance?
To redirect all requests for your site to a "maintenance" url, use mod_rewrite.  I also found this useful when migrating...
06/24/2009 Comments: 0
I'm seeing funny characters or boxes on my website after upgrading / moving to a new server. How do I fix it?
If you have any special characters in your html code, like », or ®, you need to make sure Apache...
06/28/2009 Comments: 0
How can I block links from another website to my website?
There are some sites out there that "steal" your content by dynamically pulling your content into their iframe (website).   The...
06/26/2009 Comments: 0
How can I redirect incorrect hostnames to the proper one?
Sometimes people access your site using a different hostname than you'd prefer.  This example shows how to redirect a person...
06/23/2009 Comments: 0
How can I set up a proper 301 redirect with an htaccess file?
When moving pages around on your website, it's important to set up redirects to the new pages, so that search...
02/07/2012 Comments: 0
How can I force my php scripts to run php5 ?
Some hosting providers are still using php 4 as their default for scripts, but offer php5 as well.  To force...
02/07/2012 Comments: 0
How can I see what virtual hosts apache is loading when it starts up?
After restarting apache, run this command: apachectl -S This dumps all the virtual hosts loaded by apache, and other useful information....
02/07/2012 Comments: 0
How can I check if a php script is running on SSL?
Sometimes you need to make sure your script is running on SSL, for security purposes.  Here's a short function you...
02/07/2012 Comments: 0
Why does my site load the Apache manual at the /manual/ URL?
There's a "nice" included config file that comes with apache which causes this.  On your server, go to /etc/httpd/conf.d (or...
02/07/2012 Comments: 0
How can I do a simple rewrite for vanity URL's?
Using apache and .htaccess, you can add a line like this to set up seo friendly vanity URL's: RewriteRule ^vanity_url$ /index.php/articles/read/499...
02/07/2012 Comments: 0
What might cause random 404 errors on my website?
Assuming your hosting provider isn't having any problems, this might be caused by an apache module called "mod_security".  This module...
02/07/2012 Comments: 0
How can I redirect 301 old URL's to new ones?
Using a .htaccess file, here's how to redirect old URL's to new ones.  Also included is a way to keep...
02/07/2012 Comments: 0
How can I set my images and css to be cached by browsers for better performance?
In apache, using an .htaccess file, you can do this:   # 365 days<filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">Header set Cache-Control "max-age=31536000, public"</filesMatch> # 3 days<filesMatch "\.(css|js)$">Header...
02/07/2012 Comments: 0



Powered by KnowledgebasePublisher 1.1
Host Gator
Content provided by Roberts WebForge, Inc.