【发布时间】:2023-04-01 00:38:01
【问题描述】:
这是我现在的 .htaccess 文件:
Options +FollowSymLinks -MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} gions [NC]
RewriteRule ^ - [R=410,NC,L,PT]
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^promotii.*$ http://%{HTTP_HOST}/rochii-mireasa/promotii/ [R=301,L]
RewriteRule ^colectia.*$ http://%{HTTP_HOST}/rochii-de-mireasa/ [R=301,L]
RewriteRule ^material.*$ http://%{HTTP_HOST}/rochii-de-mireasa/ [R=301,L]
RewriteRule ^stil.*$ http://%{HTTP_HOST}/rochii-de-mireasa/ [R=301,L]
RewriteRule ^decolteu.*$ http://%{HTTP_HOST}/rochii-de-mireasa/ [R=301,L]
RewriteCond %{REQUEST_URI} ^(.*)gions$
RewriteRule ^ - [R=410,L]
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php [L]
</IfModule>
DirectoryIndex index.php index.html index.htm
我想要以下场景:每个以 gions 结尾的 url 都应该有一个 410 错误页面。现在无论我做什么,它都不起作用,即使这是第一条规则。仅匹配重定向到 index.php 的最后一条规则。
我可以做些什么来改变这个并为每个以 gions 结尾的 url 提供 410 页?
【问题讨论】:
标签: regex apache .htaccess mod-rewrite url-rewriting