2016-10-03 4 views
-1

Ich brauche deine Hilfe Ich versuche, meine URL-Format zu ändern, aber ich kann nicht, dass ich immer Object Not Found Fehler bekomme.So ändern Sie URL-Format mit htaccess

Echt URL lautet: http://localhost/website/page.php?pid=about

Ich mag diese URL wollen .htaccess mit http://localhost/website/about.php

Mein Code ist:

<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> 
+1

Mögliche Duplikat [? .htaccess saubere URLs, was ist der beste Weg, es zu tun] (http://stackoverflow.com/questions/12661287/ htaccess-clean-urls-whats-the-best-way-to-do-it) – Dez

Antwort

0

es so Versuchen Sie, für Ihre URL ähnlich wie 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] 
+0

Wieder bin ich vor demselben Problem Objekt nicht gefunden. –

0

Verwenden Sie dies in Ihrem .htaccess:

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

Es wird Sie mit der URL verlassen: http://localhost/website/about.php