サーバーフォルダに物理的な変更を加えずにアドレスバーでこの変更を行うには、サイトがあり、htaccessコードが必要です
example.com/data/65767.htmlをexample.com/65767にする
example.com/data/56-45.htmlはexample.com/56-45になります
よろしく
サーバーフォルダに物理的な変更を加えずにアドレスバーでこの変更を行うには、サイトがあり、htaccessコードが必要です
example.com/data/65767.htmlをexample.com/65767にする
example.com/data/56-45.htmlはexample.com/56-45になります
よろしく
ひどく非効率的です、あなたはあなたのリンクがないものを指すように変更されることを確認する必要があります.html
、しかし...
RewriteEngine On
# externally redirect so that the browser shows the non-.html URL
RewriteCond %{THE_REQUEST} ^(GET|POST|HEAD)\ /data/([0-9-]+)\.html
RewriteRule ^ /%2 [L,R=301]
# internally rewrite the non-.html URI back to the .html URI
RewriteCond %{DOCUMENT_ROOT}/data%{REQUEST_URI}.html -f
RewriteRule ^/?([0-9-]+)$ /data/$1.html [L]
これは/data/<any number of digits or "-">
URIで機能します。何かで動作させたい場合は、をに置き換え[0-9-]
ます.
編集:
にリダイレクト
example.com/65767.html
しexample.com/65767
てコンテンツを送信することもできますかexample.com/data/65767.html
ええ、最初のルールを次のように変更するだけです。
RewriteCond %{THE_REQUEST} ^(GET|POST|HEAD)\ /(data/)?([0-9-]+)\.html
RewriteRule ^ /%3 [L,R=301]