.htaccess ha e kenyeletse 301 redirect bypass pseudo static exception foldara molao oa tsamaiso

Ha websaete ea WordPress e kenngoa ho Apache, faele ea .htaccess e sebelisoa ho totobatsa melao ea ho ngola bocha.

Leha ho le jwalo, ka dinako tse ding ha mananeo a mang a ntse a sebetsa, jwalo ka CWP custom subdomain folder directory paths edit the vhosts file , ho a hlokahala ho qhelela ka thoko dibuka tsa difoldara tse 301 tse ka redirect exception ho tlola melao ya WordPress ya pseudo-static.

Se latelang ke mokhoa o mong o ka khonehang.

.htaccess ho kenyelletsa molao oa directory oa foldara 

.htaccess ha e kenyeletse melao ea foldara ea mekhelo ea 301 hape

Haeba o batla ho fetisetsa basebedisi ka bohona ho subdomain ntle le domain ya boemo bo hodimo ya www , o hloka ho eketsa molao wa ho fetisetsa faeleng ya .htaccess ho ntsha dibuka tse itseng tsa difoldara. ▼

RewriteCond %{REQUEST_URI} !^/img.chenweiliang.com/.*$ [NC]

Beha khoutu ena pele ho molao oa pele oa ho fihlela mosebetsi o boletsoeng oa ho qoelisoa ▼

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/img.chenweiliang.com/.*$ [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
  • Ka mor'a hore litlhophiso li sebetse, kena bukeng ea foldara /img.chenweiliang.com/ Maqephe a ka hare ho WordPress a ke ke a sebetsoa ke WordPress.

Sengoloa sa bobeli /go/ se ke ke sa tsamaisoa hape

Blog ea Chen Weiliang e sebelisa mofuta o lefelloang oa plugin ea WordPress GTranslate, 'me ho tiisitsoe hore plugin ea GTranslate ha e sebelise /go/ e le subdirectory kapa subdomain.

E fumanoe ho sebelisoa plugin ea Pretty Link ho eketsa litsela tse lingChen Weiliangtsa blogthelekramoHa mocha o hokela:
https://www.chenweiliang.com/go/tgchannel

  • (Sena ke hobane sehokelo sa ho tlola sa Pretty Link plugin se ngotsoe holimo ke molao oa redirection oa RewriteRule faeleng ea .htaccess)

E tla itihela ho subdomain e seng teng:
http://go. chenweiliang.com/go/tgchannel

  • (Ho qoba lihokelo tse shoeleng, eketsa sebaka ka mor'a hore u tsamaee. sehokelong se kaholimo)

Leha ho le jwalo, patlo ya faele ya .htaccess ya blog ya Chen Weiliang ha e a ka ya fumana RewriteRule e nang le /go/.

Kamora hore ke leke ho tlosa GTranslate config RewriteRule, sehokelo sena se ile sa tsamaiswa hape ka katleho:
https://www.chenweiliang.com/go/tgchannel

  • Kahoo, ke na le bonnete ba hore GTranslate config RewriteRule e baka phoso ea ho tsamaisa sehokelo sa subdirectory /go/.

Mokhoa oa ho qhelela ka thoko /go/ subdirectory?

Haeba o hloka ho qhelela ka thoko dibuka tse nyane tse fapaneng, o ka sheba melao ya phetisetso e ka tlase ho e eketsa ▼

RewriteCond %{REQUEST_URI} !^/?(directory1|directory2)($|/)
  • Ho directory1|directory2|etc kenya palo e lakatsehang ea li-directory ho.
  • Sena e lokela ho ba "haeba REQUEST_URI e sa qale ka /directory1 kapa /directory2".

e tla lumellana:

  • /directory1/dasdas
  • /directory1
  • /directory1/

le tse ling tse ngata ……

Mokhoa oa ho beha lihokelo tsa ho se kenyelle /go/ jump jump ho RewriteRule?

Kenya feela taelo e latelang ea "ho se kenye /go/ subdirectory redirectory" kaholimo ho molao oa phetisetso ea GTranslate▼

# Exclude /go/ subdirectory redirection
RewriteCond %{REQUEST_URI} !^/?(go)($|/)

### BEGIN GTranslate config ###
RewriteRule ^([a-z]{2}|af|sq|am|ar|hy|az|eu|be|bn|bs|bg|ca|ceb|ny|zh-CN|zh-TW|co|hr|cs|da|nl|en|eo|et|tl|fi|fr|fy|gl|ka|de|el|gu|ht|ha|haw|iw|hi|hmn|hu|is|ig|id|ga|it|ja|jw|kn|kk|km|ko|ku|ky|lo|la|lv|lt|lb|mk|mg|ms|ml|mt|mi|mr|mn|my|ne|no|ps|fa|pl|pt|pa|ro|ru|sm|gd|sr|st|sn|sd|si|sk|sl|so|es|su|sw|sv|tg|ta|te|th|tr|uk|ur|uz|vi|cy|xh|yi|yo|zu)/(.*)$ http://$1.chenweiliang.com/$2 [R=301,L,QSA]

RewriteRule ^(af|sq|am|ar|hy|az|eu|be|bn|bs|bg|ca|ceb|ny|zh-CN|zh-TW|co|hr|cs|da|nl|en|eo|et|tl|fi|fr|fy|gl|ka|de|el|gu|ht|ha|haw|iw|hi|hmn|hu|is|ig|id|ga|it|ja|jw|kn|kk|km|ko|ku|ky|lo|la|lv|lt|lb|mk|mg|ms|ml|mt|mi|mr|mn|my|ne|no|ps|fa|pl|pt|pa|ro|ru|sm|gd|sr|st|sn|sd|si|sk|sl|so|es|su|sw|sv|tg|ta|te|th|tr|uk|ur|uz|vi|cy|xh|yi|yo|zu)/(af|sq|am|ar|hy|az|eu|be|bn|bs|bg|ca|ceb|ny|zh-CN|zh-TW|co|hr|cs|da|nl|en|eo|et|tl|fi|fr|fy|gl|ka|de|el|gu|ht|ha|haw|iw|hi|hmn|hu|is|ig|id|ga|it|ja|jw|kn|kk|km|ko|ku|ky|lo|la|lv|lt|lb|mk|mg|ms|ml|mt|mi|mr|mn|my|ne|no|ps|fa|pl|pt|pa|ro|ru|sm|gd|sr|st|sn|sd|si|sk|sl|so|es|su|sw|sv|tg|ta|te|th|tr|uk|ur|uz|vi|cy|xh|yi|yo|zu)/(.*)$ /$1/$3 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(af|sq|am|ar|hy|az|eu|be|bn|bs|bg|ca|ceb|ny|zh-CN|zh-TW|co|hr|cs|da|nl|en|eo|et|tl|fi|fr|fy|gl|ka|de|el|gu|ht|ha|haw|iw|hi|hmn|hu|is|ig|id|ga|it|ja|jw|kn|kk|km|ko|ku|ky|lo|la|lv|lt|lb|mk|mg|ms|ml|mt|mi|mr|mn|my|ne|no|ps|fa|pl|pt|pa|ro|ru|sm|gd|sr|st|sn|sd|si|sk|sl|so|es|su|sw|sv|tg|ta|te|th|tr|uk|ur|uz|vi|cy|xh|yi|yo|zu)/(.*)$ /wp-content/plugins/gtranslate/url_addon/gtranslate.php?glang=$1&gurl=$2 [L,QSA]
RewriteRule ^(af|sq|am|ar|hy|az|eu|be|bn|bs|bg|ca|ceb|ny|zh-CN|zh-TW|co|hr|cs|da|nl|en|eo|et|tl|fi|fr|fy|gl|ka|de|el|gu|ht|ha|haw|iw|hi|hmn|hu|is|ig|id|ga|it|ja|jw|kn|kk|km|ko|ku|ky|lo|la|lv|lt|lb|mk|mg|ms|ml|mt|mi|mr|mn|my|ne|no|ps|fa|pl|pt|pa|ro|ru|sm|gd|sr|st|sn|sd|si|sk|sl|so|es|su|sw|sv|tg|ta|te|th|tr|uk|ur|uz|vi|cy|xh|yi|yo|zu)$ /$1/ [R=301,L]
### END GTranslate config ###

Re tšepa hore sengoloa se reng "Ho sa kenyeletsoe Li-Redirect tse 301 le ho Feta Melao ea Bukana ea Lifoldara tsa Pseudo-Static Exception ho .htaccess" se arolelanoeng ho blog ea Chen Weiliang ( https://www.chenweiliang.com/ ) se tla u thusa.

Ikutloe u lokolohile ho arolelana sehokelo sa sengoloa sena: https://www.chenweiliang.com/cwl-28236.html

Ho notlolla maqheka a patiloeng🔑, rea u amohela ho kenela mocha oa rona oa Telegraph!

Share le ho rata haeba u e rata! Likabelo tsa hau le tseo u li ratileng ke khothatso ea rona e tsoelang pele!

 

Comments

您的邮箱地址不会被公开。必填项已用*标注

Scroll ho Top