-1

I need your help I am trying to change my URL format but I cannot do that I keep getting Object Not Found error.

Real URL is : http://localhost/website/page.php?pid=about

I want like this url using htaccess http://localhost/website/about.php

My code is:

<IfModule mod_rewrite.c>
    RewriteEngine On
    #RewriteCond %{HTTP_HOST} !^www\.
    #RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}.php !-f
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(([a-zA-z0-9\_\-\+]+))\.html|([a-zA-z0-9\_\-]+)\.php$ page.php?pptype=$2&pppage=$3&id=$4 [QSA,NC,L]

</IfModule>
Joe
  • 4,877
  • 5
  • 30
  • 51
  • 1
    Possible duplicate of [htaccess clean URL's what's the best way to do it?](http://stackoverflow.com/questions/12661287/htaccess-clean-urls-whats-the-best-way-to-do-it) – Dez Oct 03 '16 at 11:37

2 Answers2

0

Try it like this for your url similar to http://localhost/website/about.php

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewrwiteRule ^([\w-]+)/([\w-]+).php$ $1/page.php?pid=$2 [L]
Abhishek Gurjar
  • 7,426
  • 10
  • 37
  • 45
0

Use this in your .htaccess:

RewriteEngine On
RewriteRule ^website/([^/]*)\.php$ /website/page.php?pid=$1 [L]

It will leave you with the URL: http://localhost/website/about.php

Joe
  • 4,877
  • 5
  • 30
  • 51