How to rewrite urls in .htsccess?

Discussion in 'Apache' started by falconlink, Feb 17, 2012.

  1. #1
    Hi,

    I am a php programmer and have started to learn SEO tips recently. I came to face a problem with writing .htaccess codes. I have created a .htaccess page and uploaded that. But problem is while I click on about.php, it move to about.html and then get a 404 (page not found) error. Here is the code, I have written exactly-

    RewriteEngine on
    RewriteBase /
    RewriteRule ^(.*)\.php$ $1.html [R=permanent]
    
    RewriteEngine on
    RewriteRule ^profile/page-([0-9]+)\.html$ profile.php?page=$1
    Code (markup):
    I have few static and dynamic urls-
    /about.php
    /services.php
    /contact.php
    /portfolio.php?page=2

    But I want to show like-
    /about.html
    /services.html
    /contact.html
    /portfolio/page-2.html

    Can anybody help me to solve the problem?
     
    falconlink, Feb 17, 2012 IP
    theauthor likes this.