动态 url 更改问题
dynamic url change issue
我想将我的 URL 从 https://website.com/free?s=new-check
更改为 https://website.com/free/new-check/
我当前的 htaccess 代码:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php
RewriteRule ^/?(.*)\.php$ / [L,R=301]
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^/?(.*)$ /.php [L]
RewriteCond %{THE_REQUEST} /free\?s=([^\s]+) [NC]
RewriteRule ^ /%1? [NC,L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ /free?s= [NC,L]
它有效并指向 https://website.com/new-check
但我想要的是 https://website.com/free/new-check/
之前我从 URL.
中删除了 .php 扩展名
我尝试了很多解决方案,但没有任何效果。请帮助我
使用您显示的示例,请尝试遵循 htaccess 规则。如果您的文件中还有其他规则,请确保将这些规则放在 htaccess 文件的顶部。
请确保在测试您的 URL 之前清除您的浏览器缓存。
RewriteEngine On
##https apply rules here.
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
##External redirect Rule here.
RewriteCond %{THE_REQUEST} \s/(free)\?s=([^\s]+)\s [NC]
RewriteRule ^ /%1/%2? [L,R=301]
##Internal rewrite rule here.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(?:[^/]*)/(.*)/?$ free.php?s= [NC,QSA,L]
我想将我的 URL 从 https://website.com/free?s=new-check
更改为 https://website.com/free/new-check/
我当前的 htaccess 代码:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php
RewriteRule ^/?(.*)\.php$ / [L,R=301]
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^/?(.*)$ /.php [L]
RewriteCond %{THE_REQUEST} /free\?s=([^\s]+) [NC]
RewriteRule ^ /%1? [NC,L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ /free?s= [NC,L]
它有效并指向 https://website.com/new-check
但我想要的是 https://website.com/free/new-check/
之前我从 URL.
我尝试了很多解决方案,但没有任何效果。请帮助我
使用您显示的示例,请尝试遵循 htaccess 规则。如果您的文件中还有其他规则,请确保将这些规则放在 htaccess 文件的顶部。
请确保在测试您的 URL 之前清除您的浏览器缓存。
RewriteEngine On
##https apply rules here.
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
##External redirect Rule here.
RewriteCond %{THE_REQUEST} \s/(free)\?s=([^\s]+)\s [NC]
RewriteRule ^ /%1/%2? [L,R=301]
##Internal rewrite rule here.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(?:[^/]*)/(.*)/?$ free.php?s= [NC,QSA,L]