|
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...
|
|
|
|
 |
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...
|
|
|
|
 |
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...
|
|
|
|
 |
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...
|
|
|
|
 |
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...
|
|
|
|
 |
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...
|
|
|
|
 |
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...
|
|
|
|
 |
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...
|
|
|
|
 |
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....
|
|
|
|
 |
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...
|
|
|
|
 |
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...
|
|
|
|
 |
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...
|
|
|
|
 |
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...
|
|
|
|
 |
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...
|
|
|
|
 |
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...
|
|
|
|