url-rewriting 相关问题

URL重写引擎是修改Web URL外观(URL重写)的软件。重写的URL用于提供更短和更相关的网页链接,将用户从过时的URL路由到替换,或简化URL的格式以便人类可读。该技术在用于生成网页的文件和呈现给世界的URL之间增加了一定程度的分离。

Wordpress 搜索页面 URL 中的层次分类术语

我想创建一个在搜索页面中包含友好 URL 的 WordPress 网站。我有一个名为“化妆品”的自定义帖子类型,并且该帖子类型有一个名为“化妆品类型”和“化妆品类型”的自定义分类法...

回答 1 投票 0

IIS 重写规则中的多个条件未被识别

我正在使用 IIS 重写规则来尝试重定向子域 - 例如 来自:www.example.com 至:example.com 或者 来自:this.example.com 至:example.com 规则: 我正在使用 IIS 重写规则来尝试重定向子域 - 例如 来自:www.example.com 致:example.com 或者 来自:this.example.com 致:example.com 规则: <rule name="RedirectAll" enabled="true" stopProcessing="false"> <match url="(.*)" /> <conditions logicalGrouping="MatchAny" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" /> <add input="{HTTP_HOST}" pattern="^(this\.)(.*)$" /> </conditions> <action type="Redirect" url="https://{C:2}{REQUEST_URI}" redirectType="Permanent" /> </rule> www重定向有效,但规则的this部分不会触发,因此,如果我转到this.example.com,我最终会得到以下响应: 您的连接不是私人的 攻击者可能试图窃取您的 来自 this.example.com 的信息(例如密码、消息 或信用卡)。了解更多NET::ERR_CERT_COMMON_NAME_INVALID 我并不是在寻求有关该错误的帮助,因为我意识到该错误是因为我没有链接到子域的证书。 即使我更改规则并删除 www 部分,this 条件也不会触发: <rule name="RedirectAll" enabled="true" stopProcessing="false"> <match url="(.*)" /> <conditions logicalGrouping="MatchAny" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="^(this\.)(.*)$" /> </conditions> <action type="Redirect" url="https://{C:2}{REQUEST_URI}" redirectType="Permanent" /> </rule> 如果我在 IIS 中测试上述规则 this 它工作正常: 为什么在网站上使用时只有 www 条件有效,而 this 测试不起作用,即使根据屏幕截图测试这两个规则时,两者都工作正常? 一旦该规则包含在 web.config 中并与现有设置一起包含,IIS 是否会忽略除 wwww 规则之外的任何内容? 下面列出了完整的 web.config。 <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL"> <remove statusCode="500" subStatusCode="100" /> <remove statusCode="500" subStatusCode="-1" /> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="404" path="/error_404.asp" responseMode="ExecuteURL" /> <error statusCode="500" prefixLanguageFilePath="" path="/error_500.asp" responseMode="ExecuteURL" /> <error statusCode="500" subStatusCode="100" path="/error_500.asp" responseMode="ExecuteURL" /> </httpErrors> <rewrite> <!-- https://blog.elmah.io/web-config-redirects-with-rewrite-rules-https-www-and-more/ --> <rules> <rule name="RedirectToHTTPS" enabled="true" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> </conditions> <action type="Redirect" url="https://{SERVER_NAME}/{R:1}" redirectType="Permanent" /> </rule> <rule name="RedirectAll" enabled="true" stopProcessing="false"> <match url="(.*)" /> <conditions logicalGrouping="MatchAny" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" /> <add input="{HTTP_HOST}" pattern="^(this\.)(.*)$" /> </conditions> <action type="Redirect" url="https://{C:2}{REQUEST_URI}" redirectType="Permanent" /> </rule> <!-- https://sublimecoding.com/blocking-bots-in-iis/ Added 30th September 2020 --> <rule name="RequestBlockingRule1" enabled="true" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_USER_AGENT}" matchType="Pattern" pattern="^$|EasouSpider|Add Catalog|PaperLiBot|Spiceworks|ZumBot|RU_Bot|Wget|Java/1.7.0_25|Slurp|FunWebProducts|80legs|Aboundex|AcoiRobot|Acoon Robot|AhrefsBot|aihit|AlkalineBOT|AnzwersCrawl|Arachnoidea|ArchitextSpider|archive|Autonomy Spider|Baiduspider|BecomeBot|benderthewebrobot|BlackWidow|Bork-edition|Bot mailto:[email protected]|botje|catchbot|changedetection|Charlotte|ChinaClaw|commoncrawl|ConveraCrawler|Covario|crawler|curl|Custo|data mining development project|DigExt|DISCo|discobot|discoveryengine|DOC|DoCoMo|DotBot|Download Demon|Download Ninja|eCatch|EirGrabber|EmailSiphon|EmailWolf|eurobot|Exabot|Express WebPictures|ExtractorPro|EyeNetIE|Ezooms|Fetch|Fetch API|filterdb|findfiles|findlinks|FlashGet|flightdeckreports|FollowSite Bot|Gaisbot|genieBot|GetRight|GetWeb!|gigablast|Gigabot|Go-Ahead-Got-It|Go!Zilla|GrabNet|Grafula|GT::WWW|hailoo|heritrix|HMView|houxou|HTTP::Lite|HTTrack|ia_archiver|IBM EVV|id-search|IDBot|Image Stripper|Image Sucker|Indy Library|InterGET|Internet Ninja|internetmemory|ISC Systems iRc Search 2.1|JetCar|JOC Web Spider|k2spider|larbin|larbin|LeechFTP|libghttp|libwww|libwww-perl|linko|LinkWalker|lwp-trivial|Mass Downloader|metadatalabs|MFC_Tear_Sample|Microsoft URL Control|MIDown tool|Missigua|Missigua Locator|Mister PiX|MJ12bot|MOREnet|MSIECrawler|msnbot|naver|Navroad|NearSite|Net Vampire|NetAnts|NetSpider|NetZIP|NextGenSearchBot|NPBot|Nutch|Octopus|Offline Explorer|Offline Navigator|omni-explorer|PageGrabber|panscient|panscient.com|Papa Foto|pavuk|pcBrowser|PECL::HTTP|PHP/|PHPCrawl|picsearch|pipl|pmoz|PredictYourBabySearchToolbar|RealDownload|Referrer Karma|ReGet|reverseget|rogerbot|ScoutJet|SearchBot|seexie|seoprofiler|Servage Robot|SeznamBot|shopwiki|sindice|sistrix|SiteSnagger|SiteSnagger|smart.apnoti.com|SmartDownload|Snoopy|Sosospider|spbot|suggybot|SuperBot|SuperHTTP|SuperPagesUrlVerifyBot|Surfbot|SurveyBot|SurveyBot|swebot|Synapse|Tagoobot|tAkeOut|Teleport|Teleport Pro|TeleportPro|TweetmemeBot|TwengaBot|twiceler|UbiCrawler|uptimerobot|URI::Fetch|urllib|User-Agent|VoidEYE|VoilaBot|WBSearchBot|Web Image Collector|Web Sucker|WebAuto|WebCopier|WebCopier|WebFetch|WebGo IS|WebLeacher|WebReaper|WebSauger|Website eXtractor|Website Quester|WebStripper|WebStripper|WebWhacker|WebZIP|WebZIP|Wells Search II|WEP Search|Widow|winHTTP|WWWOFFLE|Xaldon WebSpider|Xenu|yacybot|yandex|YandexBot|YandexImages|yBot|YesupBot|YodaoBot|yolinkBot|youdao|Zao|Zealbot|Zeus|ZyBORG|PetalBot|petalbot|aiohttp|Yahoo Ad monitoring" ignoreCase="true" negate="false" /> </conditions> <action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied." statusDescription="You do not have permission to view this directory or page using the credentials that you supplied." /> </rule> </rules> </rewrite> <httpCompression directory="%SystemDrive%\websites\_compressed" minFileSizeForComp="1024" noCompressionForProxies="false" noCompressionForHttp10="false"> <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /> <staticTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="message/*" enabled="true" /> <add mimeType="application/javascript" enabled="true" /> <add mimeType="application/json" enabled="true" /> <add mimeType="image/jpeg" enabled="true" /> <add mimeType="image/gif" enabled="true" /> <add mimeType="image/png" enabled="true" /> <add mimeType="application/javascript" enabled="true" /> <add mimeType="text/css" enabled="true" /> <add mimeType="*/*" enabled="false" /> </staticTypes> </httpCompression> <staticContent> <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" /> </staticContent> <tracing> <traceFailedRequests> <remove path="*" /> </traceFailedRequests> </tracing> <security> <requestFiltering> <filteringRules> <remove name="BlockBots" /> </filteringRules> </requestFiltering> </security> </system.webServer> </configuration> 您看到的错误消息“NET::ERR_CERT_COMMON_NAME_INVALID”表示 SSL 证书存在问题,因为它与您尝试访问的域不匹配。这就是您的规则无法按预期工作的原因。 SSL 证书是针对特定域名(通用名称)颁发的,或者可能包含具有通配符证书的多个子域(例如 *.example.com)。如果您对“example.com”使用常规 SSL 证书,而不是覆盖“this.example.com”的通配符证书,则当您尝试访问“this.example.com”时,SSL 握手将会失败。当然,重定向规则不会继续执行。

回答 1 投票 0

Nginx 将图片网址从子域重定向到 Cloudfront

我需要有关 nginx 重写旧链接的快速帮助。 旧链接:http://widgets.domain.com/person/106400.jpg 新链接:http://xxxxxxx.cloudfront.net/old/widgets/106400.jpg 谢谢!

回答 2 投票 0

.Net Core url 重写的查询字符串问题

在 ASP.NET Core 中开发应用程序时,我在尝试重写单个 url 时遇到问题,例如: https://localhost:44318/Details?content=My-url-to-rewrite&id=221 进入 https://localhost:44318/mypage...

回答 1 投票 0

IIS URL 重写不重写用户友好的 URL

我使用 IIS 向导设置了一个简单的重写规则,应该重写: https://example.com/products/detail/ABC-123 到 https://example/com/products/detail.php?sku=ABC-123 规则是: 我使用 IIS 向导设置了一个简单的重写规则,应该重写: https://example.com/products/detail/ABC-123 到 https://example/com/products/detail.php?sku=ABC-123 规则是: <rule name="RewriteUserFriendlyURL2" stopProcessing="true"> <match url=".*/products/detail/([^/]+)/?$" /> <conditions> </conditions> <action type="Rewrite" url="https://example.com/products/detail.php?sku={R:1}" /> </rule> 当我在 IIS 编辑规则 -> 测试模式对话框中测试友好 URL 时,有一个匹配, R:0 是 https://example.com/products/detail/ABC-123 R:1 是 ABC-123。 然而,当我在浏览器中输入友好的 URL 时,我只是收到 404 错误。不幸的是我看不到它实际输出的重写的网址是什么,有没有办法找出结果? 请尝试以下重写规则: <rewrite> <rules> <rule name="RewriteUserFriendlyURL2"> <match url="^products/detail/([_0-9a-z-]+)" /> <action type="Rewrite" url="products/detail.php?sku={R:1}" /> </rule> </rules> </rewrite>

回答 1 投票 0

如何过滤请求以便apache处理它们而不是tomcat?

由于各种原因,我想在闲置一段时间后关闭我的服务器。我在 Debian 4.9.88 上运行 Tomcat 8.5.29 和 Apache2(不确定版本)。我写了一个脚本来查看...

回答 1 投票 0

使用 Apache mod rewrite 修改查询字符串

我知道可以在我的 htaccess 中使用 mod 重写 拿: http://example.com/directory/perlscript.pl?base64encodedquery=jhfkjdshfsdf78fs8y7sd8 制作一个较短的网址: http://example.com/?什么...

回答 2 投票 0

如何在.htaccess中将“一个文件”从.php mod_rewrite到.html?

mod_rewrite“一个文件”从 .php 到 .htaccess 中的 .html 的语法是什么? 我有所有文件的语法,但如何为一个文件执行此操作?

回答 1 投票 0

重写友好的URL,不同的模式

我有以下重写规则 选项 +FollowSymlinks 重写引擎开启 RewriteRule ^/(.*)/(.*)/(.*)$ /member-profile.php?ID=$2 [L] 我有以下重写规则 <filesMatch "^(member)$"> Options +FollowSymlinks RewriteEngine on RewriteRule ^/(.*)/(.*)/(.*)$ /member-profile.php?ID=$2 [L] </filesMatch> <filesMatch "^(community-events)$"> Options +FollowSymlinks RewriteEngine on RewriteRule ^/(.*)/(.*)/(.*)/(.*)$ /community-events.php?ID=$3 [L] </filesMatch> 这显然是重写这个 mydomain.com/comunity-events/category/id/name 到此 mydomain.com/comunity-events.php?myvariables 现在,我想要一个没有起始“文件夹”的新重定向,就像这样 mydomain.com/business-category/business-name 到 mydomain.com/business-profile.php?variables 在当前配置下,这是否可能,无需为每个类别名称进行重定向? 您甚至不需要 filesMatch 指令,因为您可以匹配 RewriteRule 本身的起始部分。 您可以使用以下规则替换 .htaccess: Options +FollowSymlinks -MultiViews RewriteEngine On # handle /member/... RewriteRule ^/?(member)/(.*)/(.*)$ /member-profile.php?ID=$2 [L,QSA,NC] # handle /community-events/... RewriteRule ^/?(community-events)/(.*)/(.*)/(.*)$ /community-events.php?ID=$3 [L,QSA,NC] # handle /business-category/business-name RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/?(.*)/(.*)$ business-profile.php?name=$2 [L,QSA]

回答 1 投票 0

任何关键字到物理子文件夹的 htaccess 规则

我正在努力处理有关文件夹的事情。我有一个名为“admin”的子文件夹,因此我可以通过 mydomain.com/admin 访问该网站。 但是我希望如果我说 mydomai...

回答 1 投票 0

非ascii字符、连字符、下划线和括号的重写规则?

我想允许非 ASCII 字符出现在我的网址中。 过去我运行以下重写规则 RewriteRule ^([\w()-]+)/?$ rewrite.php?a=$1 [NC,L,QSA] 重写规则 ^([\w()-]+)/([\w()...

回答 1 投票 0

URL 友好的 htaccess

我一直致力于使我的网站中的网址更加用户友好: 所以我一直在这样修改htaccess: 重写引擎开启 RewriteRule ^diseno-grafico/([^/.]+)/([^/.]+)$ diseno-grafico-filtr...

回答 1 投票 0

tuckey urlrewrite 将支持 jakarta 和 tuckey urlrewrite 的替代品

目前tuckey urlrewrite内部使用javax,所以我面临着jakarta和javax之间的类型不匹配错误,因为我的项目使用jakarta来支持tomcat 10。 所以我想知道什么时候 tucky

回答 4 投票 0

htaccess 将 url 更改为更友好的

我最近可以让我的一些网址更加用户友好。 但现在我有一些问题可以改变其他的。 例如这个: https://ugocd.com/ilustracion-filtro?id=Retrato%20Digital&

回答 1 投票 0

IIS 重定向规则重定向所有子域流量

我在我网站的 web.config 文件中定义了这个重写规则: 我在我网站的 web.config 文件中定义了此重写规则: <rule name="RedirectWwwToNonWww" enabled="true" stopProcessing="false"> <match url="(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" /> </conditions> <action type="Redirect" url="https://{C:2}{REQUEST_URI}" redirectType="Permanent" /> </rule> 规则将重定向如下: 来自:www.example.com/test 致:example.com/test 该规则工作正常,但是,我想更改规则,以便所有子域重定向到主站点 - 例如 来自:this.example.com/test 致:example.com/test 或者 来自:something.example.com/test 致:example.com/test 我正在努力研究如何更改正则表达式来实现这一目标。 我尝试过这种模式: <add input="{HTTP_HOST}" pattern="^([^.]+)\.(.*)$" /> 其工作原理如下: 来自:something.example.com/test.html 致:example.com/test.html 但是,当没有子域时,它不会执行我的要求,因为我最终得到: 来自:example.com/test.html 致:com/test.html 如何修改规则,以便子域重定向到主站点,但如果没有子域,则规则不会触发? 我提供一个思路,就是可以用多个条件来匹配,然后设置为logicalGrouping="MatchAny",只要满足其中一个条件,就会进行重定向。您可以使用此示例作为参考: <rule name="RedirectWwwToNonWww" enabled="true" stopProcessing="false"> <match url="(.*)" /> <conditions logicalGrouping="MatchAny" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" /> <add input="{HTTP_HOST}" pattern="^([^.]+)\.(.*)$" /> </conditions> <action type="Redirect" url="https://{C:2}{REQUEST_URI}" redirectType="Permanent" /> </rule>

回答 1 投票 0

IIS - 重写 Url 虚拟 url

我有两个用 net Framework 4.5 编写的网络应用程序。第一个是前端应用程序,第二个是公开一些 api 的后端应用程序。两者位于两个独立的域,并且位于不同的端口...

回答 1 投票 0

URL有注释字符吗?

是否有可以在 URL 中使用的特定字符,浏览器会忽略该字符之后的任何文本? 例如:如果波形符是这样的字符,并且我有一个链接(机智...

回答 2 投票 0

如何使用 php 服务器(php.exe)创建 SEO 友好的 URL?

我有一个带有 php.exe 的简单本地服务器,并使用命令提示符启动服务器: php -S 本地主机:80 -t“网络/” 如何从以下网址进入网络浏览器: 本地主机/blog.php?id=1 搜索引擎优化...

回答 1 投票 0

查询字符串参数的 IIS url 重写规则

我有类似这样的网址: https://www.example.com/en-us/searchresults.aspx?Search=seachterm 请注意,参数“搜索”以大写字母开头。 如何创建保留所有内容的重写规则...

回答 1 投票 0

集成文本重写器 API 以进行 AI 内容创建

我目前正在从事一个人工智能内容创建项目,我希望集成文本重写器 API 以提高生成内容的质量和独特性。该项目的目标...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.