Я пытаюсь сделать перенаправление.htaccess на некоторые веб-страницы, как обычно. Вот как я получил работу:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^Profile/(.+)/?$ index.php?page=profile&username=$1 [NC,L]
RewriteRule ^profile/(.+)/?$ index.php?page=profile&username=$1 [NC,L]
RewriteRule ^Profile/Me index.php?page=profile [NC,L]
RewriteRule ^Profile/me index.php?page=profile [NC,L]
RewriteRule ^profile/Me index.php?page=profile [NC,L]
RewriteRule ^profile/me index.php?page=profile [NC,L]
RewriteRule ^Personagem/(.+)/?$ index.php?page=personagem&personagem=$1 [NC,L]
RewriteRule ^personagem/(.+)/?$ index.php?page=personagem&personagem=$1 [NC,L]
И вот что мне нужно: когда я нахожусь на странице "Personagem", я могу получить доступ ко всем "альбомам" по следующему URL-адресу:
/Personagem/--name of character--/Album
Бытие, --name of character--
, параметр /Personagem
. Является ли это возможным?
Вы можете использовать:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^profile/(.+)/?$ index.php?page=profile&username=$1 [NC,L]
RewriteRule ^profile/me index.php?page=profile [NC,L]
RewriteRule ^personagem/([^/]+)/?$ index.php?page=personagem&personagem=$1 [NC,L]
RewriteRule ^personagem/([^/]+)/([^/]+)/?$ index.php?page=personagem&personagem=$1&album=$2 [NC,L]
Вы можете добавить другое:
RewriteRule ^personagem/([^/]+)/([^/]+)/([^/]+)/?$ index.php?page=personagem&personagem=$1&album=$2&other=$3 [NC,L]
Не нужно добавлять PrOfILE или PROfILe... с NC (нет случая)
/Album/
?
/Album
к шаблону? Почему все правила дублируются в другом регистре, хотя они уже используют[NC]
?