Advanced Search

Results 1 to 2 of 2

Thread: htaccess mod rewrite

  1. #1
    Join Date
    Jun 2008
    Posts
    114
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default htaccess mod rewrite

    hi

    i have my all urls ending with .php
    Code:
    http://localhost/vineet/index.php
    i have removed the extension with htacess
    Code:
    http://localhost/vineet/index/
    this is htaccess
    Code:
    Options +FollowSymlinks
    RewriteEngine On
    RewriteRule ^(.+)/$ $1.php
    now if anyone writes index.php or contactus.php . means if anyone adds the .php extension to my url then i want to show him an error page or page not found page or redirect to index page.

    but my pages should not get effected.

    vineet

  2. #2
    Join Date
    Sep 2008
    Posts
    56
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Default RE: - htaccess mod rewrite

    Hi,

    Below is the code you can put in your .htaccess to do this

    RewriteEngine On

    RewriteCond %{HTTP_HOST} ^domainname\.com\\*.php

    RewriteRule ^(.*)$ http://www.domianname.com/ /* use it if you want to redirect to home page */

    RewriteRule ^(.*)$ http://www.domianname.com/errorpage/ /* use it if you want to redirect to error page */

    Hope this works for you!

    Cheers,

    ~Maneet
    Lexolution IT Services
    Web site Development Company

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •