Some url rewriting that I have used.
First uncomment the line below in apache>conf>httpd.conf file and restart the apache server.
LoadModule rewrite_module modules/mod_rewrite.so
Now add these lines in .htaccess file
#initialize mod rewrite
Options +FollowSymlinks
RewriteEngine on
#this line will disable direct file viewing within any folder
Options -Indexes
#this configuration will disable the access of .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
#redirect news-9.html to news.php?id=9
RewriteRule ^news-([0-9]+)\.html$ news.php?id=$1
#rewrite page.php to page.html
RewriteRule ^(.*)\.html$ $1.php [nc]
# Redirect to PHP if it exists.
# e.g. example.com/foo will display the contents of example.com/foo.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L,QSA]
#redirect www.example.com/index.php?action=about to www.example.com/about.html
RewriteRule ^([^/\.]+)/?$ index.php?action=$1 [L]
Tags:
Share
You need to be a member of HoHalla to add comments!
Join this Ning Network