Posted on 04 March 2010. Tags: .htaccess
suppose you want /articles.php?cat=$1&art=$2 to become magazine/1/2
then you need these two rules:
#articles.php?cat=$1&art=$2
RewriteRule ^magazine/([^/]*)/([^/]*)$ /articles.php?cat=$1&art=$2&marker [L]
RewriteCond %{REQUEST_URI} /articles\.php [NC]
RewriteCond %{QUERY_STRING} ^cat=(.*)&art=(.*)
RewriteCond %{QUERY_STRING} !marker
RewriteRule (.*) http://mydomain/%1/%2? [R=301,L]
Posted in .htaccess
Posted on 01 March 2010. Tags: .htaccess
You might be aware of mod_rewrite rule and .htaccess file if you are using wordpress as your Blogging platform, .htaccess is the apache’s default directory level configuration files which can be used to password protect and redirect requests. Webmasters need to give special attentions to .htaccess on apache webserver as its very difficult to enforce all policies using just httpd.conf file. Read the full story
Posted in .htaccess
Posted on 25 January 2010. Tags: .htaccess, development, PHP, scripting
I m PHP 5.2.0 / Apache
and I can’t access php.ini
I try to update .htaccess
and added
php_value upload_max_filesize “25M”
php_value post_max_size “25M”
However it will give me “Internal Server Error” Read the full story
Posted in .htaccess, PHP, Programming
Posted on 03 August 2009. Tags: .htaccess
For a website that has URLs that end with a slash (/), it’s a good practice to ensure that all url links been parsed by the web server ended with trailing slash, even if visitors forget to enter the ending slash. This avoid visitors been served with 404 Page Not Found or Page Cannot be Displayed error as some webservers treat links without trailing slash as a file name instead of directory, and thus unable to locate the documents. It also eliminates the possibility that both pages with same content, one with slash at the end and another without, been viewed by search engines as duplicate content.
As an example, all hits to http://www.mydigitallife.info/contact should be redirect to http://www.mydigitallife.info/contact/. Read the full story
Posted in .htaccess
Posted on 30 July 2009. Tags: .htaccess
Creating the password file
The first step is to create a simple text file that will store your username and password, separated by a colon (:). The small catch is that the password must be encrypted. Luckily, there are many free web-based utilities that will encrypt the password for you. Try one of these:
Simply enter your desired username and password in one of these pages and submit the form. You’ll get back a string similar to the following: Read the full story
Posted in .htaccess
Posted on 26 July 2009. Tags: .htaccess
Php, MySql, .htaccess: friendly urls
There are a lot of tutorials that show how to change an address like:
- www.mysite.com/products.php?product_id=1234
into others like:
- www.mysite.com/products/1234
- www.mysite.com/products/1234.html
In this article I’d like to go one step forward and to create something like:
- www.mysite.com/easy-to-remember-product-name
- www.mysite.com/easy-to-remember-product-name.html Read the full story
Posted in .htaccess, MySQL, PHP
Posted on 05 May 2009. Tags: .htaccess, PHP, winodws, xampp.
- Using a text editor, open the httpd.conf file. In XAMPP, this file is found in the \apache\conf directory
- Locate the following line of code:
#LoadModule rewrite_module modules/mod_rewrite.so
- Remove the # from the line as seen below to enable the module:
LoadModule rewrite_module modules/mod_rewrite.so
- Save the httpd.conf file and Restart your server
- Restart your Apache Server
If all goes well, you should now be able to use .htaccess files.
Posted in PHP, Programming, Windows
Posted on 03 April 2009. Tags: .htaccess
| The .htaccess is a simple method that allows you to customise the way the webserver works on a per directory basis. The .htaccess file is a simple ASCII text file, which when placed in a certain directory in your webspace, will cause the webserver to use that configuration on all files in that directory and any files in any subdirectories.
When you have finished creating your .htaccess code, click on the “Select All” button and copy (CTRL + C) and paste (CTRL + V) the code into a text editor and save the file as .htaccess. The .htaccess file should have the name “.htaccess” (all lowercase), and can either be created using a command line text editor when logged in using ssh or can be uploaded by ftp.
more info |
Posted in .htaccess, Programming
Posted on 08 August 2008. Tags: .htaccess, asp, cfusion, PHP
301 Redirect
301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It’s not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it’s the safest option. The code “301″ is interpreted as “moved permanently”.
You can Test your redirection with Search Engine Friendly Redirect Checker
Below are a Couple of methods to implement URL Redirection Read the full story
Posted in .htaccess, HTML - XHTML, JavaScript - Ajax, PHP
Posted on 08 August 2008. Tags: .htaccess
To Move a single page
Quick, easy and seamless for your visitors.
Redirect 301 /oldpage.html http://www.example.com/newpage.html
To Move an entire site
This will catch any traffic on your old site and redirect it to your index page on your new server. If you want to redirect each page to its new spot, this isn’t the one for you.
Redirect 301 / http://www.example.com/
Changed file extension?
This example is perfect if you’ve decided to switch to .php from .html pages. It will look for any .html page and redirect it to .php (ie http://www.example.com/yourpage.html and redirect it to http://www.example.com/yourpage.php). Now, be careful with this, it does mean any html page. I did this on one of my sites and had totally forgotten I had an iframe with .html content on some pages… I didn’t notice for weeks that it was broken :S.
So learn from my mistake
check, double check, then check again.
RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php
Posted in .htaccess, HTML - XHTML
Posted on 06 August 2008. Tags: .htaccess
Redirect www to non www version of site
It’s best to stick with either always using www.example.com or just example.com. Allowing both can confuse the search engines. So here’s how to force your site to always show the non-www version. (Search for “canonical url errors” in your favorite search engine for more info.)
Note: If you do use either of the next 2 codes below, and use a secure server (ie. https:) be sure to check that it doesn’t redirect the secure to the insecure version. I’m pretty sure this will do that and that isn’t something you want!
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^example\.com
RewriteRule (.*) http://example.com/$1 [R=301,L]
Redirect non-www to www
Same as above except in the reverse, this one forces the www. into your url.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]
Posted in HTML - XHTML