Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ウェブサイトを作成し、サーバーにアップロードしました。URLは常にベースURLに書き換えたい。たとえば、のようなページにいる場合http://www.website.com/page.php、常に表示したいhttp://www.website.com
http://www.website.com/page.php
http://www.website.com
オンラインでいくつかのコードを記述する回答を見つけました.htaccessが、どれも機能しませんでした。助けてください
.htaccess
簡単に言えば、phpのページ名とGET属性を非表示にして、ベースURLを常に表示したい。
目指しているのはきっと
RewriteRule ^page.php / [L]
基本的な .htaccess:
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]