Я прочитал всю тему про следующий вопрос, но я не могу решения плавника .. На моем CodeIgniter проекта, у меня есть по этой ссылке, чтобы увидеть пользователь Profil:URL Переписывая CodeIgniter - С GET ID
user/profil?id=1
Но я хочу
user/profil/1
И я не могу найти решение .. Где поставить код? Нужен ли мне ROUTE или .htaccess? Моя htacess выглядит так.
# Empêche la visualisation de l'arborescence, n'a rien à voir avec le masquage du « index.php ».
Options -Indexes
# Active le module de réécriture d'URL.
RewriteEngine on
#
# Fixe les règles de réécriture d'URL. Ici, nous utilisons une liste blanche.
#
# Toutes les URL qui ne correspondent pas à ces masques sont réécrites.
RewriteCond $1 !^(index\.php|assets/|robots\.txt|uploads)
# Toutes les autres URL vont être redirigées vers le fichier index.php.
RewriteRule ^(.*)$ index.php/$1 [L]
Мои контроллеры Profil:
public function profil()
{
// Récupération de l'ID dans l'url
$this->data['id'] = $this->input->get('id', TRUE);
// Statistiques du profil
$this->data['countReview'] = $this->review_model->countReview($this->data['id']);
// Chargement du profil de l'utilisateur
if (ctype_digit($this->data['id'])) {
if ($this->user_model->getUser($this->data['id'])) {
$this->data['users'] = $this->user_model->getUser($this->data['id']);
$this->data['reviewsNext'] = $this->review_model->getReviewsByUser_Next($this->data['id']);
$this->data['reviewsPrevious'] = $this->review_model->getReviewsByUser_Previous($this->data['id']);
} else {
$this->session->set_flashdata('error', 'Utilisateur introuvable.');
}
} else {
$this->data['error_report'][] = "Utilisateur introuvable.";
}
$this->load->view('template/header');
$this->load->view('template/menu');
$this->load->view('user/profil', $this->data);
$this->load->view('template/footer');
}
спасибо за ваш ответ.
Возможный дубликат [URL переписывание с помощью PHP] (http://stackoverflow.com/questions/16388959/url-rewriting-with-php) –
Спасибо, но по ссылке у него есть текст. У меня есть только ID – Haandler
Возможно, это поможет http://stackoverflow.com/questions/26223464/custom-url-in-codeigniter –