gpt4 book ai didi

apache - htaccess 重定向

转载 作者:行者123 更新时间:2023-12-05 01:35:29 25 4
gpt4 key购买 nike

我一直试图找到使用 .htaccess 重定向以下网址的解决方案:

来自:

mydomain.com/my-short-list/1AXC7682 or mydomain.com/my-short-list/1AXC7682/

至:
mydomain.com/my-short-list/?u=1AXC7682

来自:
mydomain.com/user-reviews/42 or mydomain.com/user-reviews/42/

至:
mydomain.com/user-reviews/?urid=42 

最后:

来自:
mydomain.com/videos/1055687406001/130433/bmw-i8-concept-sports-car-in-detail or  
mydomain.com/videos/1055687406001/130433/bmw-i8-concept-sports-car-in-detail/

至:
mydomain.com/videos/?vid=1055687406001&pid=130433&url=bmw-i8-concept-sports-car-in-detail

谢谢!

最佳答案

使用以下代码更新您的 .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^my\-short\-list/([0-9]{1}[a-z0-9]{7})/?$ /my-short-list/?u=$1 [NC,L]
RewriteRule ^user\-reviews/([0-9]+)/?$ /user-reviews/?urid=$1 [NC,L]
RewriteRule ^videos/([0-9]+)/([0-9]+)/([a-z0-9\-]+) /videos/?vid=$1&pid=$2&url=$3 [NC,L]

#wp default
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>

关于apache - htaccess 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8205620/

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