2017-02-08 6 views
0

私は、開発されたExpressionEngineサイトの支援を依頼されました。それはindex.phpを経由して行くように、ファイルまたはディレクトリではありません何かを書き換え、既存の.htaccessファイルがあります:Apache rewrite/product/to/products /とindex.php

RewriteEngine On 
RewriteBase/
# Not a file or directory (also catches index.php) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php?$1 [L] 

これは正常に動作し、例のURLは次のようになります。

WWW .mysite.com /製品/ fooの(複数の製品 ')

しかし、それはまた形態であろう古いのURLに対処する必要があります。

www.mysite.com/product/foo(単数'商品')

は、私は次のことを試してみた:

RewriteEngine On 
RewriteBase/
# Not a file or directory (also catches index.php) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^product/(.+) /index.php/products/$1 [L] 
RewriteRule ^(.*)$ /index.php?$1 [L] 

それは「製品」を見つけた場合、それはindex.phpを経由して「製品」に書き換えて、その後終了しますが、それは働いていないことを願って。

同時に、私が始まる任意の着信URLが必要です。

に書き換えする

/部署/ fooの :

/部門/カテゴリ/ fooの

greatefully受け取ったすべてのヘルプを。

+0

はポストごとに一つの質問をしてください。 – anubhava

答えて

1

あなたはマッピングproduct -> productsのために、既存のルールの上にルールを追加使用することができます。

RewriteEngine On 
RewriteBase/

RewriteRule ^product(/.*)?$ products$1 [L,NC] 

# Not a file or directory (also catches index.php) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php?$1 [L] 
関連する問題