|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Member
Iscritto dal: Aug 2009
Messaggi: 220
|
[.htaccess] URL Rewrite Parzialmente Funzionante
Salve a tutti,
sto facendo un file .htaccess per il classo URL Rewriting solo che mi succede una cosa strana. Allora io ho due tipi di URL: localhost/index.php?action=news localhost/index.php?action=news&view=1 Ho scritto il seguente codice nel file .htaccess: Codice:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} index\.php
RewriteCond %{QUERY_STRING} ^action=([a-z]+)$
RewriteRule ^index\.php$ /%1? [R=301,L]
RewriteRule ^([a-z]+)$ index.php?action=$0 [L]
RewriteCond %{QUERY_STRING} ^action=([a-z]+)&view=([0-9]+)$
RewriteRule ^index\.php$ /%1/%2? [R=301,L]
RewriteRule ^([a-z]+)/([0-9]+)$ index.php?action=$0&view=$1 [L]
Allora se io digito: localhost/index.php?action=news FUNZIONA! localhost/news FUNZIONA! localhost/index.php?action=news&view=1 FUNZIONA localhost/news/1 NON FUNZIONA Come posso risolvere questa cosa? EDIT: mi sono accorto che localhost/news/1 mi prende come unico GET news/1 e quindi non riesco ad andare nel database a prendere la news 1. Infatti risulta index.php?action=news/1 invece di index.php?action=news&view=1 come potrei risolvere? Grazie in anticipo. Saluti Andrea. Ultima modifica di Anarchia_92 : 01-07-2013 alle 19:38. |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 21:20.



















