Hello developer,
1)Rewriting product.php?id=12 to product-12.html
It is a simple redirection in which .php extension is hidden from the browser’s address bar and dynamic url (containing “?” character) is converted into a static URL.
RewriteEngine on
RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1 2) Rewriting product.php?id=12 to product/ipod-nano/12.html SEO expert always suggest to display the main keyword in the URL. In the following URL rewriting technique you can display the name of the product in URL.
RewriteEngine on
RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2 3) Redirecting non
To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts.
URL to
To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts.
URL
If you type yahoo.com in browser it will be redirected to
To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts.. If you want to do same with your website then put the following code to .htaccess file. What is benefit of this kind of redirection?? Please check the post about
To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts. RewriteEngine On
RewriteCond %{HTTP_HOST} ^optimaxwebsolutions\.com$
RewriteRule (.*)
To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts.
Rewriting yoursite.com/user.php?username=xyz to yoursite.com/xyz
Have you checked zorpia.com.If you type
To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts.
in browser you can see my profile over there. If you want to do the same kind of redirection i.e
To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts.
to
To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts.
then you can add the following code to the .htaccess file.
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1
5) Redirecting the domain to a new subfolder of inside public_html.
Suppose the you’ve redeveloped your site and all the new development reside inside the “new” folder of inside root folder.Then the new development of the website can be accessed like “test.com/new”. Now moving these files to the root folder can be a hectic process so you can create the following code inside the .htaccess file and place it under the root folder of the website. In result,
To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts.
point out to the files inside “new” folder.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^test\.com$ [OR]
RewriteCond %{HTTP_HOST} ^
To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts.
RewriteCond %{REQUEST_URI} !^/new/
RewriteRule (.*) /new/$1
Source -
To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts.
- SmartzKool