HoHalla

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]

Share 

Add a Comment

You need to be a member of HoHalla to add comments!

Join this Ning Network

About

Translate This Network

CNN Tech

Loading feed

Smashing Magazine

Loading feed

Events

Music

Loading…

© 2009   Created by Shakeel Shrestha on Ning.   Create a Ning Network!

Badges  |  Report an Issue  |  Privacy  |  Terms of Service

Sign in to chat!