0

数日前、私はこれに関連する質問を投稿し、大きなプッシュを得ました。また、私はいくつかの実験と研究を行い、いくつかの良い結果を達成しました. これがまさに私が達成したことです。これを自分のフォルダーの.htaccessに入れました-「フォルダー」:

RewriteEngine On

#Look for the word "post" and take everything after "post" and store it in $1
RewriteRule   post(.+)$   something.php?file=$1   [L]

# allow public pages
RewriteRule ^index.php$ - [L]
RewriteRule ^style.css$ - [L]
RewriteRule ^bg.png$ - [L]
RewriteRule ^cat_bgg.gif$ - [L]
RewriteRule ^cat_bgr.png$ - [L]
RewriteRule ^h1_bg.gif$ - [L]
RewriteRule ^hd_bg.png$ - [L]
RewriteRule ^menu_bg.png$ - [L]

# serve everyone from specific-domain or specific-user-agent
RewriteCond %{HTTP_REFERER} ^http?://www.abc.com [OR]
RewriteCond %{HTTP_USER_AGENT} ^specific-user-agent$
RewriteRule ^ - [L]

# everybody else receives a forbidden
RewriteRule ^ - [F]

ErrorDocument 403 /index.php

これが現在の動作です。リンクを貼りました:

www.abc.com

なので

www.xyz.com/folder/post(somecode)

誰かがこのリンクをクリックすると、.htaccess に従って「somecode」が取得され、$1 に保存されて処理されます。

www.xyz.com/folder/something.php?file=$1

このコンテンツを表示します。ただし、ブラウザに表示される URL は次のとおりです。

www.xyz.com/folder/post(somecode)。

今、これが私がやりたいことです。表示する代わりに:

www.xyz.com/folder/post(somecode)

次のような素敵なものを見せてもらえますか

www.xyz.com/somethingnice

また

www.xyz.com/folder/someword

どうすればいいですか?行 RewriteRule post(.+)$ something.php?file=$1 [L] の後に何か追加する必要がありますか?

それとも何か他の方法がありますか?

4

0 に答える 0