をリダイレクト:htaccessのエリアでこれを入れてhttp://localhost/prefix/games/u_id/game-name問題は、以下のサイトで
:http://htaccess.madewithlove.be/
が持つ要求URLを記入http://localhost/prefix/protected/files/u_id/game-name
:RewriteEngine On
RewriteBase /prefix
# stop directory listings
Options -Indexes
#stops htaccess views
<Files .htaccess>
order allow,deny
deny from all
</Files>
# redirect game folders
RewriteRule ^prefix/games/(.*)$ prefix/protected/files/$1 [L]
# remove .php; use THE_REQUEST to prevent infinite loops
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP
RewriteRule (.*)\.php$ $1 [R=301]
# remove index
RewriteRule (.*)/index$ $1/ [R=301]
# remove slash if not directory
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /$
RewriteRule (.*)/ $1 [R=301]
# add .php to access file, but don't redirect
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
ErrorDocument 404 /prefix/error-404.php
結果として出てきます
ここでhtaccessファイルをwamp localhostサーバーに置き、リクエストURLに入力したのと同じURLに移動しますそのサイトに404ページが見つかりませんでした...そして、私がテストサイト(上記のもの)から結果ページにアクセスすると、そこにあるindex.phpページが読み込まれます。
ローカルホストのウェブサイトでリダイレクトが機能していません。何か案は? htaccessファイルが確実に実行されています。
EDIT :: ///
私のApacheのアクセスログが出力されます。
127.0.0.1 - - [25/Apr/2012:18:44:02 +0100] "GET /prefix/games/u_id/game-name HTTP/1.1" 404 116
127.0.0.1 - - [25/Apr/2012:18:44:02 +0100] "GET /favicon.ico HTTP/1.1" 404 209
EDIT :: ///
解決しました。
私の質問を明確にすることはできますか?私はまだこの問題で絶望的に失われています。 – Jimmyt1988
あなたのhtaccessがルートディレクトリの内部にある場合、 'RewriteBase/prefix'は正しいことがあります。 htaccessがプレフィックスディレクトリの内側にある場合、あなたの書き換えはprefixで始まらないようにしてください。 htaccessはどこにありますか? – Gerben
「プレフィックス」と呼ばれるルートディレクトリのhtaccess: http://localhost/prefix/.htaccess – Jimmyt1988