Add Trailing Slash to the End of the URL with .htaccess Rewrite Rules末尾にスラッシュを追加されたURLの終わりにします。 htaccessのrewriteルール

For a website that has URLs that end with a slash (/), it’sa good practice to ensure that all url links been parsed by the web server ended with trailing slash, even if visitors forget to enter the ending slash.は、ウェブサイトを運営して使用しているの末尾にスラッシュ( / ) 、これは良い練習を確保するため、すべてのURLリンクは、 Webサーバーで解釈され、末尾にスラッシュ終わった場合でも、訪問者を忘れるスラッシュを入力して終了します。 This avoid visitors been served with 404 Page Not Found or Page Cannot be Displayed error as some web servers treat links without trailing slash as a file name instead of directory, and thus unable to locate the documents.このサービスを避けるために訪問者も404ページが見つかりませんまたはページが表示されるエラーが発生することはできませんとして扱うリンクがなく、いくつかのウェブサーバーのファイル名を末尾にスラッシュの代わりとしてディレクトリ、およびそのための文書を見つけることができません。 It also eliminates the possibility that both pages with same content, one with slash at the end and another without, been viewed by search engines as duplicate content.排除する可能性があることも、両方のページと同じコンテンツを、 1つの末尾にスラッシュと別のせず、表示された検索エンジンは、重複したコンテンツです。

As an example, all hits to http://www.mydigitallife.info/contact should be redirect to http://www.mydigitallife.info/contact/.一例として、すべてのヒットをhttp://www.mydigitallife.info/contact http://www.mydigitallife.info/contact/にリダイレクトする必要があります。

Most web server, including the popular Apache HTTPD web server supports mod_rewrite module where rules can be set in .htaccess file in order to redirect to add trailing slash to the URLs that does not already have one.ほとんどのウェブサーバー、ウェブサーバーのhttpdなどの人気のApacheのルールをサポートしてmod_rewriteモジュールのどこで設定できる。 htaccessファイルの末尾にスラッシュを追加するためにリダイレクトされていないのURLを既にお持ちの1つです。

The following code can be put in .htaccess to redirect URL without trailing slash to URL with trailing slash:は、次のコードはに置かれる。 htaccessを使用せずにリダイレクトするURLの末尾にスラッシュを末尾にスラッシュをURL :

RewriteEngine On RewriteEngine on経験上、
RewriteBase / rewritebase /
RewriteCond %{REQUEST_FILENAME} !-f rewritecond % ( REQUEST_FILENAME )の! - f
RewriteCond %{REQUEST_URI} !index.php rewritecond % ( request_uri ) ! index.phpを
RewriteCond %{REQUEST_URI} !(.*)/$ rewritecond % ( request_uri ) !(.*)/$
RewriteRule ^(.*)$ http://domain.com/$1/ [L,R=301] rewriterule ^(.*)$ http://domain.com/ $ 1 / [であるL 、 R = 301 ]

orまたは

RewriteCond %{REQUEST_FILENAME} !-f rewritecond % ( REQUEST_FILENAME )の! - f
RewriteCond %{REQUEST_URI} !\..+$ rewritecond % ( request_uri ) ! \ .. + $
RewriteCond %{REQUEST_URI} !/$ rewritecond % ( request_uri ) ! / $
RewriteRule (.*) http://www.mydigitallife.info/$1/ [R=301,L] rewriterule ( .* ) http://www.mydigitallife.info/ $ 1 / [研究= 301 、左]

orまたは

RewriteEngine On RewriteEngine on経験上、
RewriteBase / rewritebase /
RewriteRule ^([a-zA-Z0-9]+)/$ /$1 [L] rewriterule ^ ( [する座- z0 - 9 ]+)/$ / $ 1 [左]
RewriteCond %{THE_REQUEST} ^[AZ]{3,9}\ /([a-zA-Z0-9]+) rewritecond % ( the_request ) ^ [アリゾナ] ( 3,9 ) \ / ( [座- z0 - 9 ] + )
RewriteRule ^([a-zA-Z0-9]+)$ /%1/? rewriterule ^ ( [する座- z0 - 9 ] + ) $ / % 1 /ですか? [R=301,L] [研究= 301 、左]

In you’re using CMS or blog such as Wordpress that allows custom URL structure for permalinks, especially for search engine optimization (SEO), the above code should come before the block of rewrite conditions and rules for URL customization for the CMS or blog platform.をお使いのCMSやブログなどのWordPress permalinksを使用することができるカスタムURLの構造を、特に検索エンジン最適化( SEO )は、上記のコードブロックの前に来る必要条件とのルールを書き換えるのURLやブログのカスタマイズは、プラットフォームのCMSです。

Brief explaination of the rewrite code to add trailing slash to URL 簡単な説明を書き換えるコードをURLの末尾にスラッシュを追加する

RewriteEngine On - This line enables the runtime rewriting engine based on mod_rewrite module of Apache. RewriteEngine on経験上、 -この行に基づいて書き換えエンジンを使用すると、ランタイムはm od_rewriteモジュールのA pacheです。

RewriteBase / - This line sets the current page root directory as base URL for per-directory rewrites. rewritebase / -この行セットをベースとして、現在のページのルートディレクトリのU RLを1ディレクトリに書き換えた。

RewriteCond %{REQUEST_FILENAME} !-f - This line excludes all URLs pointing to existed files from been added with trailing slash again. rewritecond % ( REQUEST_FILENAME )の! - f -この行を除くすべてのU RLからのファイルの存在を指して、末尾にスラッシュを再度追加されました。 Directories cannot be excluded as this would exclude the rewrite behavior for existing directories.ディレクトリを除外することはできませんこれは除外するとして、既存のディレクトリを書き換えるの動作をします。

RewriteCond %{REQUEST_URI} !index.php - This line is optional, and will excludes a sample URL (in this case, index.php) that users do not want it to be rewritten. rewritecond % ( request_uri ) ! index.phpを-この行は任意ですが、除外するとサンプルU RL(この場合、 i ndex.phpを)を利用しない場合はそれを書き直したものです。 Remove this line if not necessary.この行を削除していない場合は必要です。

RewriteCond %{REQUEST_URI} !\..+$ - Specify that the URL does not contain any . rewritecond % ( request_uri ) ! \ .. + $ -指定するには、任意のU RLが含まれていません。 (dot) to exclude reference to file. (ドット)を除外するファイルの参照をします。

RewriteCond %{REQUEST_URI} !(.*)/$ - This line determines which URL doesn’t contain a trailing slash rewritecond % ( request_uri ) !(.*)/$ -この行を決定どのようなU RLの末尾にスラッシュが含まれていません

RewriteRule ^(.*)$ http://www.domain.com/$1/ [L,R=301] - This line process URL without trailing slash that has passed conditions set above, by appending a trailing slash and then redirect with 301 or permanent redirect status to the new URL. rewriterule ^(.*)$ http://www.domain.com/ $ 1 / [であるL 、 R = 301 ] -この行プロセスのU RLに末尾にスラッシュの条件を設定して渡されるように、末尾にスラッシュを付け加えると入力し、リダイレクトに301または新しいURLの状態を恒久的にリダイレクトします。 L mean this is the last line to process and the rewrite process can be terminated.これは、左の最後の行に意味を処理すると書き換えプロセスが終了します。 Remember to replace the www.domain.com with your own domain name. www.domain.comに置き換えるのを忘れないで、独自のドメイン名を入力します。

Brief explaination for second set of rewrite rules and rule conditions 簡単な説明を書き換えるルールやルールセットの2番目の条件

RewriteRule ^([a-zA-Z0-9]+)/$ /$1 [L] - This line terminates the trailing slash appending rewrite process if the URL already contains trailing slash. rewriterule ^ ( [する座- z0 - 9 ]+)/$ / $ 1 [左] -この行の末尾にスラッシュ付け加える書き換えプロセスが終了する場合は、末尾にスラッシュのU RL既に含まれています。

RewriteCond %{THE_REQUEST} ^[AZ]{3,9}\ /([a-zA-Z0-9]+) - This line determines request that does not ends with trailing slash. rewritecond % ( the_request ) ^ [アリゾナ] ( 3,9 ) \ / ( [座- z0 - 9 ] + ) -この行を要求されていないと判断末尾にスラッシュで終わる。

RewriteRule ^([a-zA-Z0-9]+)$ /%1/? rewriterule ^ ( [する座- z0 - 9 ] + ) $ / % 1 /ですか? [R=301,L] - This line append a slash to the end of URI and perform a 301 permanent redirect to the new URL with trailing slash, and terminate the rewrite block. [研究= 301 、左] -この行の末尾にスラッシュをヨルリンウリの終わりに恒久的にリダイレクトされる3 01を実行すると、新しいU RLに末尾にスラッシュ、および終了して書き換えるブロックします。

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要 :これは、機械翻訳ページで提供"現状有姿"を保証します。 Machine translation may be difficult to understand.機械翻訳を理解するのは難しいかもしれません。 Please refer toを参照してください original English articleオリジナルの英語記事索引 whenever possible.いつ可能です。

Share and contribute or get technical support and help atを共有して貢献や技術サポートとヘルプを得る My Digital Life Forums 私のデジタルライフフォーラム .です。



One Response to “Add Trailing Slash to the End of the URL with .htaccess Rewrite Rules” 1つの応答を"末尾にスラッシュを追加されたURLの終わりにします。 htaccessのrewriteルール"

  1. Na SEO muÅ¡ke - Vybrali.sme.sk a ukonÄ ujúce lomeno v URL | SEO chat ¡なソmuå集-u konäu j㺠c el omenov ybrali.sme.skをU RLで指定する|ソチャット
    July 26th, 2008 05:19 2008年7月26日05:19
    1

    [...] Ä Ãm predÃdete aj problému Ä .2. [...] predãdeteのAJ problã ©ムーãm ä ä .2 。 Pre htaccess som naÅ¡iel pekný, ale anglický Ä lánok o tom, how to add trailing slash to the end of the URL. htaccessのサウンドiel peknã事前naå ¡ ½ 、エールlã ¡ ä ½ anglickãノルウェークローネまたはトムは、末尾にスラッシュを追加する方法を終わりにしてください。 Možnosti máte [...] moå ¾ nosti mã ¡ te [...]

Leave a Reply残して返信

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> これらのタグを使用することができます: <aのhref=のtitle= <abbrのtitle= <blockquote cite=""> <cite> <acronymのtitle= <b>ダウンロードの<code> <デル日時= " " >の<em> <i>て<strike> <strong> <q cite="">

Subscribe without commenting登録なしのコメント


Custom Search

New Articles新しい記事

Incoming Search Terms for the Article検索用語を受信するには

mod rewrite trailing slash mod書き換える末尾にスラッシュ - - mod rewrite add slash mod書き換えるスラッシュを追加 - - mod_rewrite add trailing slash mod_rewriteの末尾にスラッシュを追加 - - mod_rewrite append slash スラッシュmod_rewriteのアペンド - - mod_rewrite add slash mod_rewriteのスラッシュを追加 - - 301 trailing slash 301末尾にスラッシュ - - mod rewrite add trailing slash mod書き換える末尾にスラッシュを追加 - - php htaccess urls slash PHPのhtaccessのURLのスラッシュ - - trailing slash htaccess htaccessの末尾にスラッシュ - - trailing slash 末尾にスラッシュ - - .htaccess add trailing slash 。 htaccessを末尾にスラッシュを追加 - - rewriterule add trailing slash rewriterule末尾にスラッシュを追加 - - htaccess redirect slash htaccessのリダイレクトスラッシュ - - mod_rewrite append trailing slash mod_rewriteの末尾にスラッシュアペンド - - apache rewrite trailing slash Apacheの書き換え末尾にスラッシュ - - wordpress add slash at end of url WordPressのスラッシュ末のURLを追加 - - apache rewrite add trailing slash Apacheの書き換え末尾にスラッシュを追加 - - how to remove multiple slashes from domain スラッシュから複数のドメインを削除する方法 - - rewriterule trailing slash rewriterule末尾にスラッシュ - - mod rewrite append trailing slash mod書き換えるアペンド末尾にスラッシュ - - RewriteRule slash rewriteruleスラッシュ - - directory slash rewrite ディレクトリのスラッシュ書き換える - - htaccess remove trailing slash htaccessの末尾にスラッシュを削除 - - RewriteRule fix trailing slash 末尾にスラッシュrewriterule修正 - - apache rewrite add slash Apacheの書き換えスラッシュを追加 - - mod rewrite optional trailing slash mod書き換えるオプションの末尾にスラッシュ - - "add slash" htaccess "追加スラッシュ" htaccessに - - rewrite url trailing slash 書き換えるURLの末尾にスラッシュ - - wordpress trailing slash url WordPressの末尾にスラッシュのURL - - htaccess redirect trailing slash htaccessの末尾にスラッシュリダイレクト - - php slash url PHPのスラッシュのURL - - htaccess add trailing slash htaccessの末尾にスラッシュを追加 - - apache slash at end of url Apacheのスラッシュ末のURL - - mod_rewrite slash mod_rewriteのスラッシュ - - mod_rewrite remove trailing slash mod_rewriteの末尾にスラッシュを削除 - - php + rewrite + add trailing slash +書き換え+ PHPの末尾にスラッシュを追加 - - rewrite add trailing slash 書き換え末尾にスラッシュを追加 - - seo trailing slash SEOの末尾にスラッシュ - - url trailing slash URLの末尾にスラッシュ - - rewrite htaccess add slash htaccessを書き換えるスラッシュを追加 - - htaccess ending slash htaccessのエンディングスラッシュ - - remove trailing slash htaccess htaccessの末尾にスラッシュを削除 - - rewrite add trailing slash to url URLの末尾にスラッシュを追加書き換える - - rewrite trailing slash 末尾にスラッシュ書き換える - - mod_rewrite slash at the end mod_rewriteのスラッシュの最後に - - htaccess add trailing slash directory htaccessのディレクトリの末尾にスラッシュを追加 - - php remove trailing slash PHPの末尾にスラッシュを削除 - - add slash rewrite カートスラッシュ書き換える - - apache add slash Apacheの追加スラッシュ - - apache redirect trailing slash Apacheのリダイレクトの末尾にスラッシュ - -