-3

Possible Duplicate:
remove .php extension with .htaccess

Rightnow my site url is like this:

www.viaviweb.com/about_us.php

i want this to appear like this:

www.viaviweb.com/aboutus
Community
  • 1
  • 1
RuchiS
  • 27
  • 4
  • 1
    read about .htaccess and rewrite rule – pkachhia Oct 20 '12 at 10:40
  • 1
    Depends on what webserver you use. If you use apache then have a look at rewrite rules. E.g. http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/ – cb0 Oct 20 '12 at 10:41
  • possible duplicate of [remove .php extension with .htaccess](http://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess) or http://stackoverflow.com/questions/9736591/remove-php-extension-from-url or http://stackoverflow.com/questions/9736591/remove-php-extension-from-url or http://stackoverflow.com/questions/4908122/removing-the-php-extension-with-mod-rewrite or http://stackoverflow.com/questions/10706737/remove-the-file-extension-php-using-htaccess-file or http://stackoverflow.com/questions/9821222/remove-php-extension-explicitly-written-for-friendly-url – PeeHaa Oct 20 '12 at 10:46
  • And many many more. Please use the search before asking a question. – PeeHaa Oct 20 '12 at 10:48

4 Answers4

2

You'll have to use RewriteRule with the rewrite engine enable to do this. Create a empty file named .htaccess and put it in the base folder of your website and type this in to the file:

Options +FollowSymlinks
RewriteEngine On

RewriteRule ^aboutus$    about_us.php [L]

Make sure to enable the mod_rewrite module in your Apache server in order to make this work properly. Read more about rewrite in Apache here: http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Airikr
  • 6,258
  • 15
  • 59
  • 110
1

You have to create some rules in .htaccess, in you main folder you have a file named .htaccess (if it's not available you have to create one) and put these rules.

RewriteCond %{HTTP_HOST} ^www\.domain\.com
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP
RewriteRule (.*)\.php$ $1 [R=301]
Peter O.
  • 32,158
  • 14
  • 82
  • 96
Supun Praneeth
  • 3,087
  • 2
  • 30
  • 33
0

How to remove .php extension using URL Rewriting / mod_rewrite

I hope this might be helpful to you.

Ami
  • 4,241
  • 6
  • 41
  • 75
0
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L] 
RewriteRule about_us.php(.*)$ aboutus?$1 [L,QSA]
StaticVariable
  • 5,253
  • 4
  • 23
  • 45