2017-03-09 5 views
1

Ich habe eine .htaccess-Datei und ich möchte mehr Ressourcen hinzufügen wie ich jetzt habe.Htaccess - Mehrere Parameter

Jetzt habe ich: /resources/<id>

Aber ich will: /resources/<id>/<name>

Dies ist meine aktuellen .htaccess

RewriteEngine On 
RewriteBase/

RewriteCond %{THE_REQUEST} \s/+resources(?:\.php)?\?id=([a-z,A-Z,0-9]+) [NC] 
RewriteRule^resources/%1? [R,L] 
RewriteRule ^resources/([a-z,A-Z,0-9]+)/?$ resources.php?id=$1 [L,QSA] 

RewriteCond %{THE_REQUEST} \s/+profile(?:\.php)?\?id=([a-z,A-Z,0-9]+) [NC] 
RewriteRule^profile/%1? [R,L] 
RewriteRule ^profile/([a-z,A-Z,0-9]+)/?$ profile.php?name=$1 [L,QSA] 

RewriteCond %{THE_REQUEST} \s/+error(?:\.php)?\?id=([a-z,A-Z,0-9]+) [NC] 
RewriteRule^error/%1? [R,L] 
RewriteRule ^error/([a-z,A-Z,0-9]+)/?$ error.php?id=$1 [L,QSA] 

RewriteCond %{REQUEST_FILENAME}\.php -f [NC] 
RewriteRule ^(.+?)/?$ $1.php 

ErrorDocument 400 /error/400 
ErrorDocument 401 /error/401 
ErrorDocument 403 /error/403 
ErrorDocument 404 /error/404 
ErrorDocument 500 /error/500 
ErrorDocument 503 /error/503 

Redirect /index.php /home 
Redirect /index.html /home 
RewriteRule /sitemap.xml /sitemap.xml.php 

Antwort

2

Bellow dieser Regel:

RewriteRule ^resources/([a-z,A-Z,0-9]+)/?$ resources.php?id=$1 [L,QSA] 

diese Regel hinzufügen:

RewriteRule ^resources/([a-z,A-Z,0-9]+)/([a-z,A-Z,0-9]+)/?$ resources.php?id=$1&name=$2 [L,QSA] 
+0

Es hat funktioniert, Danke! –