URL моего сайта: http://example.com/website/pages/home
Ищу URL: http://example.com/pages/home
Мне нужно, чтобы это был редирект 301, чтобы поисковые системы обновляли мои ссылки.
Это то, что я получил до сих пор:
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php index.html
RewriteEngine on
\# remove /website/
RedirectMatch ^(.+)(/website/)(.+)$ $1/$3 [L]
\# remove index.php from URL
RewriteCond $1 !^(index\.php^)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
\# deny access to wget user agent
RewriteCond %{HTTP_USER_AGENT} wget [NC]
RewriteRule (.*) /$1 [L]
Что происходит с этими правилами:
Вставленный URL : http://example.com/website/pages/home
Перенаправленный URL : http://example.com/index.php/pages/home
Ожидаемые результаты : http://example.com/pages/home
Заранее спасибо за помощь.
** решаемый **
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php index.html
RewriteEngine on
# remove /website/
RedirectMatch ^(.+)(index.php/website/)(.+)$ $1$3 [R=301,L]
# remove index.php from URL
RewriteCond $1 !^(index\.php^)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
# deny access to wget user agent
RewriteCond %{HTTP_USER_AGENT} wget [NC]
RewriteRule (.*) /$1 [L]