実際に~name/how.php
の代わりに~name/how
を実行します。.htaccess/mod_rewrite
私は.htaccessファイルに次の変更を行っています
# If the requested URI does not contain a period in the final path-part
RewriteCond %{REQUEST_URI} !(.[^./]+)$
# and if it does not exist as a directory
RewriteCond %{REQUEST_fileNAME} !-d
# and if it does not exist as a file
RewriteCond %{REQUEST_fileNAME} !-f
# then add .html to get the actual filename
RewriteRule (.*) $1.php [L]
しかし、それはのように実行します:
~name/~name/how
を、すべてのリンクでそれがURLの元に~name
を追加されますクリックしてください。 http://ip/~name/~name/~name/serach
。
.htaccessで何が間違っているか教えてください。
実際、私はmod rewrite/htaccessで新しくなりました。 実際に変更する必要があるものを詳しく教えてください。 –
これは要するに、これは書き換えの問題ではありません。あなたの変更は、HTMLファイルがサブパスの下にあるように見せて、HTML内の相対パスが間違った場所になるようにします。絶対的なものへの相対的なリンクを変更するか、(DirectoryIndexの提案のように)レイアウトを変更して、相対的なリソースが実際に見える場所になるようにすることができます。 – SpliFF
こんにちは、このhttp://74.220.215.241/~laborfa2/をチェックして、どのように動作するのかをクリックしてください。しかし、 'Los Angeles'を右クリックするとエラーが発生します。 URLは http://74.220.215.241/~laborfa2/lf/main/com/search.php?area='Los Angeles ' –