0

ファイルに多くの正規表現を検索して実装しました.htaccessが、成功しません。URL を SEO フレンドリーにする一般的な方法を見つけるには?

現在、これは私の.htaccessファイルにあります:

   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]

私がする必要があるのは、次のように URL を変更することです。

http://localhost/abc/index.php?page=boats_for_sale

これに:

http://localhost/abc/boats_for_sale

同様に、URL 内のすべてのクエリ文字列を非表示にしたいと考えています。

どうすればそれを達成できますか?

4

1 に答える 1

1

そのようなもので動作します:

URL 書き換えモジュールの有効化

# Avoids problems with mod_rewrite
    Options +FollowSymlinks
# Activate rewriting module
    RewriteEngine on
# Set base URL directory rewrites
    RewriteBase /

URL パラメータの書き換え

RewriteRule ^abc/([a-zA-Z0-9_-]+)$ abc/index.php?page=$1

リライト mod バイブルをお読みください: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

于 2012-10-04T13:24:58.367 に答える