gpt4 book ai didi

.htaccess - 创建 sef 链接并用破折号 (-) 更改加号 (+)

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:33:35 25 4
gpt4 key购买 nike

我在网上搜索过并尝试解决问题,但我不知道如何解决。我想将 dizisozluk.net/words 重定向到 dizisozluk.net/ne-demek/anlami/words 并将加号 (+) 更改为破折号 (-)。例如

  • dizisozluk.net/family+tree

  • dizisozluk.net/ne-demek/anlami/family-tree

我的旧代码在这里

RewriteEngine On

RewriteCond %{HTTPS} off

RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{THE_REQUEST} /search\.php\?word=([^\s&]+) [NC]
RewriteRule ^ /%1? [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ search.php?word=$1 [QSA,L]

我怎样才能改变这个?

提前致谢。

最佳答案

这样说:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} !\s/+ne-demek/anlami/ [NC]
RewriteRule (.*) https://%{HTTP_HOST}/ne-demek/anlami/$1 [R=301,L,NE]

RewriteCond %{HTTP_HOST} !^www\. [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule .* https://www.%1%{REQUEST_URI} [L,R=301,NE]

RewriteCond %{THE_REQUEST} /search\.php\?word=([^\s&]+) [NC]
RewriteRule ^ /ne-demek/anlami/%1? [R=301,L]

# recursive rule to replace space by - from URI OR query string (anywhere)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.*?)(?:\+|%20|\s)+(.+?)\sHTTP [NC]
RewriteRule ^ /%1-%2 [L,NE,R]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ne-demek/anlami/(.+)$ search.php?word=$1 [QSA,L]

关于.htaccess - 创建 sef 链接并用破折号 (-) 更改加号 (+),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35971406/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com