URL Rewrite using .htaccess on Linux Apache and Wamp Server
URL rewriting can be one of the best and quickest ways to improve the usability and search friendliness of your site. It can also be the source of near-unending misery and suffering. Definitely worth playing carefully with it - lots of testing is recommended. With great power comes great responsibility, and all that.
URL rewriting on Linux Apache and wamp
For rewriting url on Centos Please do these steps.
- First go to '/etc/httpd/conf/httpd.conf' and for wamp left click on wamp icon and go to Apache then httpd.conf and uncomment - #LoadModule rewrite_module modules/mod_rewrite.so and #AddModule mod_rewrite.c, so do so please remove trailing #.
- Now Edit directory section in this file for directory /var/www/html and change 'AllowOverride none' to 'AllowOverride All'.
Eg. ;
Options Indexes FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
TO
;
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
- Now make a file in server root directory '/var/www/html' name .htaccess and write these line in this
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php - Now this will remove php extension in your file so now if you want to open index.php then write only http://url/index only instead of http://url/index.php
Not working it shows :
ReplyDeleteInternal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
muje samjh nhi aaya,,please ek bar or samja do
ReplyDeletemera product page hai ..aise show hota hai products.php?id=1&&cat_id=3
mje id=1&&cat_id=6 ko remove krna hai
please briefly bta do ki kaise hoga
please
my email id is devendra.kandari1988@gmail.com