0

私はこのようなURLを持っています:

www.example.com/ index.php / category-5 / subcategory / page

書き直したい:

www.example.com/ category / subcategory / page

つまり、「index.php /」と「-5」を削除したいのですが、残りはそのままにしておきます。

私はApacheで頭を悩ませています。私は通常、単純な単純なphpコードを書くだけです。

私はこれを試しましたが、うまくいきませんでした:

RewriteRule ^index.php/category-1/(.*)$ /category/($1) [NC]

ありがとう

また、それを永続的なリダイレクトにすることができれば、それは素晴らしいことです。

4

1 に答える 1

1

置換部分に括弧を使用しないでください。

RewriteRule ^index.php/category-1/(.*)$ /category/$1 [NC,R=301]

見る:

http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteoptions

http://httpd.apache.org/docs/current/rewrite/flags.html

デバッグ ログを有効にすることができます。

RewriteLog "/path-to-log/rewrite.log"
RewriteLogLevel 4
于 2013-03-19T23:47:00.987 に答える