私はこの書き換え条件を持っています:
RewriteCond %{REQUEST_URI} !.*\.(css|js|php|html|png|jpg|gif)|notes|messages|/delete/|/achors_data/|/composer/|/pagination/|/mom_mp3/|/swf/|/js/|/stories/|/wall/|/news_feed/|/notifications/|opencv|hdflvplayer|hdflvplayer2|videojs|ffmpeg|mediaplayer|uploadify|/v/|/video/|/options/|show_msg_dialogs|facedetector|classes|right_column_modules|functions|maurice|pokes|opticrop|geoip_city|/autocomplete/|chrono|ajax|editprofile|tag|Svetlozar.NET
存在しないディレクトリ (root/mydirectory/ および root/mydirectory_b/) から root/specialdirectory/ にすべてをリダイレクトする書き換えルールがあるため、ルートに作成される新しいディレクトリごとに維持する必要があります。ルートにある既存のディレクトリだけで、特別なディレクトリに移動するルールを適用する必要はありません。
私の質問は、ルートで作成されている .htaccess に新しいディレクトリごとに手動で書き込む必要がなく、rewritecond を作成するか、別の方法で同じことを達成できるかどうかです。
したがって、これはすべて (root/anydir/) を root/master に移動させる cond を使用した書き換えルールです。
RewriteCond %{REQUEST_URI} !.*\.(css|js|php|html|png|jpg|gif)|notes|messages|/delete/|/search/|/buttons/|/achors_data/|/composer/|/pagination/|/mom_mp3/|/swf/|/js/|/stories/|/wall/|/news_feed/|/notifications/|opencv|hdflvplayer|hdflvplayer2|videojs|ffmpeg|mediaplayer|uploadify|/v/|/video/|/options/|show_msg_dialogs|facedetector|classes|right_column_modules|functions|maurice|pokes|opticrop|lists|geoip_city|/autocomplete/|chrono|ajax|editprofile|tag|Svetlozar.NET
RewriteRule ^([A-Za-z-0-9-_.]+)?$ master/$2
次に、ルートのすべてのディレクトリの外側にあるディレクトリ friends のみが特定のアクションを実行する必要があるという問題があります any/friends go to anything/view_friends.php
私が望むのは、ルートの既存のすべてのディレクトリを考慮した RewriteCond を作成できるようにすることです-そのためのワイルドカードです。
したがって、メンテナンスなしで次のようなものを書くことになります
RewriteCond %{REQUEST_URI} ! * existing directories - except just one
それ以外の:
RewriteCond %{REQUEST_URI} !.*\.(css|js|php|html|png|jpg|gif)|pokes|opticrop|notes|/delete/|/search/|/buttons/|/achors_data/|/composer/|/pagination/|/mom_mp3/|/swf/|/js/|/stories/|/wall/|/news_feed/|/notifications/|opencv|hdflvplayer|hdflvplayer2|videojs|ffmpeg|mediaplayer|uploadify|/v/|/video/|/options/|show_msg_dialogs|facedetector|classes|right_column_modules|functions|maurice|lists|geoip_city|/autocomplete/|chrono|ajax|editprofile|tag|Svetlozar.NET
RewriteRule ^([A-Za-z-0-9-_.]+)/friends $1/view_friends.php
最初の rewriterule にファントム ディレクトリを使用するため、rewritecond を適用するには、ディレクトリが実際のディレクトリとして存在する必要があります。