0

適切にリダイレクトされない次のルールがあります。

#redirect from www.mysite.com/page-NAME/es to www.mysite.com/public/index.php?page=NAME/es
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule page-(.*)/es$ public/index.php?page=$1&lang=es [L]

内部的にパラメーター ページが受信されていないため、サイトは代わりにホームページを表示します。このルールが間違っているのか、完全に機能している他のルールと競合しているだけなのか、それとも順序の問題なのかはわかりません。

すべてのヘルプは大歓迎です。前もって感謝します。

以下は、私のサイトのルートにある完全な htaccess ファイルです。

Options +FollowSymlinks
RewriteEngine on

DirectoryIndex index.php

#Adds www to the domain
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.mysite.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]

#redirect from www.mysite.com/es to www.mysite.com/public/index.php?lang=es
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule /es$ public/index.php?lang=es [L]

#redirect from www.mysite.com/en to www.mysite.com/public/index.php?lang=en
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule /en$ public/index.php?lang=en [L]

#redirect from www.mysite.com/ to www.mysite.com/public/index.php
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule ^(/)?$ public/index.php [L]

#redirect from www.mysite.com/page-NAME/es to www.mysite.com/public/index.php?page=NAME/es
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule page-(.*)/es$ public/index.php?page=$1&lang=es [L]

#redirect from www.mysite.com/page-NAME to www.mysite.com/public/index.php?page=NAME
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule page-(.*)$ public/index.php?page=$1 [L]

#redirect from www.mysite.com/ to www.mysite.com/public/
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteCond %{REQUEST_URI} !public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/$1 [L]
4

1 に答える 1

0

OK、問題が発生したようです。実際には注文の問題でした。これはうまくいくようです。うまくいけば、これは同じ問題を抱えている人に役立ちます

Options +FollowSymlinks
RewriteEngine on

DirectoryIndex index.php

#Adds www to the domain
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.mysite.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]

#redirect from www.mysite.com/page-NAME/es to www.mysite.com/public/index.php?page=NAME/es
RewriteRule page-(.*)/es$ public/index.php?page=$1&lang=es [L]

#redirect from www.mysite.com/page-NAME to www.mysite.com/public/index.php?page=NAME
RewriteRule page-(.*)$ public/index.php?page=$1 [L]


#redirect from www.mysite.com/es to www.mysite.com/public/index.php?lang=es
RewriteRule /es public/index.php?lang=es [L]

#redirect from www.mysite.com/en to www.mysite.com/public/index.php?lang=en
RewriteRule /en public/index.php?lang=en [L]

#redirect from www.mysite.com/ to www.mysite.com/public/index.php
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule ^(/)?$ public/index.php [L]


#redirect from www.mysite.com/ to www.mysite.com/public/
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteCond %{REQUEST_URI} !public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/$1 [L]
于 2012-09-01T19:59:35.950 に答える