أضفت يتتبّع شقّ إلى النهاية من ال [أورل] مع [.هتكّسّ] صياغة جديدة قواعد

لموقعة أنّ يتلقّى [أورلس] أنّ ينهي مع شقّ (/), هو يكون ممارسة جيّدة أن يضمن أنّ كلّ [أورل] أنهى خطوات يكون يعرب ب ال [وب سرفر] مع يتتبّع شقّ, [إفن يف] زائرات ينسون أن يدخل النهاية شقّ. هذا يتفادى زائرات يكون يخدم مع 404 صفحة لا يؤسّس أو صفحة يستطيع لا يكون يعرض خطأ بما أنّ بعض نسيج نادلات يعاملون خطوات دون يتتبّع شقّ ك [فيل-نم] [إينستد وف] دليل, ولذلك يعجز أن يحدّد الوثائق. هو أيضا يزيل الإمكانية أنّ كلا صفحات مع نفسه محتوى, واحدة مع شقّ في النهاية وآخر بدون, يكون يشاهد ب [سرش نجن] كمحتوى مستنسخة.

كمثال, كلّ إصابات إلى http://www.mydigitallife.info/contact سوفت كنت يعيد إلى http://www.mydigitallife.info/contact/.

يساند كثير [وب سرفر], بما في ذلك الشعبيّة [أبش] [هتّبد] [وب سرفر] [مودروريت] وحدة نمطيّة حيث قواعد يستطيع كنت ثبتت في [.هتكّسّ] مبرد [إين وردر تو] أعدت أن يضيف يتتبّع شقّ إلى [أورلس] أنّ لا سابقا يتلقّى واحدة.

الرمز تالي يستطيع كنت وضعت في [.هتكّسّ] أن يعيد [أورل] دون يتتبّع شقّ إلى [أورل] مع يتتبّع شقّ:

[روريتينجن] فوق
[روريتبس]/
[روريتكند] % {[رقوستفيلنم]}! - [ف]
[روريتكند] % {[رقوستوري]}! [إيندإكس.فب]
[روريتكند] % {[رقوستوري]}! (. *)/$
[روريترول] ^ (. *) $ http://domain.com/$1/ [[ل], [ر301]]

أو

[روريتكند] % {[رقوستفيلنم]}! - [ف]
[روريتكند] % {[رقوستوري]}! \. +$
[روريتكند] % {[رقوستوري]}! /$
[روريترول] (. *) http://www.mydigitallife.info/$1/ [[ر301], [ل]]

أو

[روريتينجن] فوق
[روريتبس]/
[روريترول] ^ ([[أ-ز-ز0-9]]+)/$/$1 [[ل]]
[روريتكند] % {[ثرقوست]} ^ [[أ-ز]] {3,9} \/([[أ-ز-ز0-9]]+)
[روريترول] ^ ([[أ-ز-ز0-9]]+) $/%1/? [[ر301], [ل]]

يستعمل في أنت [كم] أو [بلوغ] مثل [ووردبرسّ] أنّ يسمح حسب الطّلب [أورل] بنية ل [برملينكس], خصوصا ل [سرش نجن] تحسين ([سو]), الرمز آنفة سوفت أتيت قبل القالب من صياغة جديدة شروط وقواعد ل [أورل] تصنيع حسب الطّلب ل ال [كم] أو [بلوغ] منصة.

[إإكسبلينأيشن] موجزة من الصياغة جديدة رمز أن يضيف يتتبّع شقّ إلى [أورل]

[روريتينجن] فوق - [لين نبل] هذا ال [رونتيم] يعيد محرك يؤسّس على [مودروريت] وحدة نمطيّة [أبش].

[روريتبس]/- يثبت هذا خطّ ال [كرّنت بج] [رووت ديركتوري] كقاعدة [أورل] ل [بر-ديركتوري] [روريتس].

[روريتكند] % {[رقوستفيلنم]}! - [ف] - يستثني هذا خطّ كلّ [أورلس] يدلّ إلى يتواجد مبارد من يكون يضاف مع يتتبّع شقّ ثانية. أدلة يستطيع لا يكون استثنيت بما أنّ هذا استثنى الصياغة جديدة تصرف لأدلة موجودة.

[روريتكند] % {[رقوستوري]}! [إيندإكس.فب] - هذا خطّ اختياريّة, ويستثني إرادة عينة [أورل] ([إين ثيس كس], [إيندإكس.فب]) أنّ مستعملات لا يريد هو أن يكون أعدت. أزلت هذا خطّ [إيف نوت] ضروريّة.

[روريتكند] % {[رقوستوري]}! \. عيّنت +$ - أنّ ال [أورل] لا يحتوي أيّ. (نقطة) أن يستثني مرجع إلى مبرد.

[روريتكند] % {[رقوستوري]}! (. *)/$ - يحدّ هذا خطّ الذي [أورل] لا يحتوي يتتبّع شقّ

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. 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.

Brief explaination for second set of rewrite rules and rule conditions

RewriteRule ^([a-zA-Z0-9]+)/$ /$1 [L] - This line terminates the trailing slash appending rewrite process if the URL already contains trailing slash.

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([a-zA-Z0-9]+) - This line determines request that does not ends with trailing slash.

RewriteRule ^([a-zA-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.

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. Na SEO muške - Vybrali.sme.sk a ukončujúce lomeno v URL | SEO chat
    July 26th, 2008 05:19
    1

    [...] čím predídete aj problému č.2. Pre htaccess som našiel pekný, ale anglický článok o tom, how to add trailing slash to the end of the URL. 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>

Subscribe without commenting


Custom Search

New Articles

Incoming Search Terms for the Article

mod rewrite trailing slash - mod rewrite add slash - mod_rewrite add trailing slash - mod_rewrite append slash - mod_rewrite add slash - trailing slash - 301 trailing slash - mod rewrite add trailing slash - php htaccess urls slash - trailing slash htaccess - .htaccess add trailing slash - rewriterule add trailing slash - htaccess redirect slash - mod_rewrite append trailing slash - apache rewrite trailing slash - wordpress add slash at end of url - joomla remove trailing slash - apache rewrite add trailing slash - how to remove multiple slashes from domain - rewriterule trailing slash - mod rewrite append trailing slash - url trailing slash - RewriteRule slash - directory slash rewrite - htaccess remove trailing slash - RewriteRule fix trailing slash - apache rewrite add slash - mod rewrite optional trailing slash - "add slash" htaccess - rewrite url trailing slash - wordpress trailing slash url - htaccess redirect trailing slash - php slash url - htaccess add slash - htaccess add trailing slash - apache slash at end of url - htaccess add slash to end - mod_rewrite slash - mod_rewrite remove trailing slash - wordpress trailing slash - php + rewrite + add trailing slash - rewrite add trailing slash - seo trailing slash - rewrite htaccess add slash - htaccess ending slash - remove trailing slash htaccess - rewrite add trailing slash to url - rewrite trailing slash - mod_rewrite slash at the end - htaccess add trailing slash directory -