.htaccess 删除URL末尾的字符串

.htaccess 删除URL末尾的字符串,.htaccess,.htaccess,我不知道如何使用.htaccess从URL末尾删除字符串{jass\u domain\u name}/jass/jass.js?cb=47。我已经浏览了这里的一系列回复,并尝试了以下所有方法——要么网站崩溃,要么给我一个js错误 RewriteCond %{REQUEST_URI} ^(.*)\{jass_domain_name}​/jass​/jass\.js\?cb=47(.*)$ RewriteRule . %1/%2 [R=301,L] RewriteCond %{REQUEST_UR

我不知道如何使用.htaccess从URL末尾删除字符串
{jass\u domain\u name}/jass/jass.js?cb=47
。我已经浏览了这里的一系列回复,并尝试了以下所有方法——要么网站崩溃,要么给我一个js错误

RewriteCond %{REQUEST_URI} ^(.*)\{jass_domain_name}​/jass​/jass\.js\?cb=47(.*)$
RewriteRule . %1/%2 [R=301,L]

RewriteCond %{REQUEST_URI} ^(.*)Q\{jass_domain_name}/jass/jass.js?cb=47\E
RewriteRule . %1/%2 [R=301,L]

RewriteCond %{REQUEST_URI} ^/([a-zA-Z0-9_-]+){jass_domain_name}/jass/jass.js?cb=47$
RewriteRule ^(.*) http://www.elearnenglishlanguage.com/blog/%1 [R,L]

RewriteRule ^/(.*)\{(.*) http://www.elearnenglishlanguage.com/blog/$1
提前谢谢你的建议

ETA my/blog/.htaccess

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.*?)%7Bjass_domain_name%7D/jass/jass\.js\?cb=47\sHTTP [NC]
RewriteRule ^ /%1? [L,NE,R=302]

#WFIPBLOCKS - Do not remove this line. Disable Web Caching in Wordfence to remove this data.
Order Deny,Allow
Deny from 54.74.250.230
Deny from 54.177.48.98
Deny from 54.177.53.123
Deny from 54.170.232.157
#Do not remove this line. Disable Web Caching in Wordfence to remove this data - WFIPBLOCKS
#WFCACHECODE - Do not remove this line. Disable Web Caching in Wordfence to remove this data.
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
    <IfModule mod_mime.c>
        AddOutputFilter DEFLATE js css htm html xml
    </IfModule>
</IfModule>
<IfModule mod_mime.c>
    AddType text/html .html_gzip
    AddEncoding gzip .html_gzip
    AddType text/xml .xml_gzip
    AddEncoding gzip .xml_gzip
</IfModule>
<IfModule mod_setenvif.c>
    SetEnvIfNoCase Request_URI \.html_gzip$ no-gzip
    SetEnvIfNoCase Request_URI \.xml_gzip$ no-gzip
</IfModule>
<IfModule mod_headers.c>
    Header set Vary "Accept-Encoding, Cookie"
</IfModule>
<IfModule mod_rewrite.c>
    #Prevents garbled chars in cached files if there is no default charset.
    AddDefaultCharset utf-8

    #Cache rules:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTPS} on
    RewriteRule .* - [E=WRDFNC_HTTPS:_https]
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteRule .* - [E=WRDFNC_ENC:_gzip]
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{HTTPS} off
    RewriteCond %{QUERY_STRING} ^(?:\d+=\d+)?$
    RewriteCond %{REQUEST_URI} (?:\/|\.html)$ [NC]

    RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|wf_logout|wordpress_logged_in|wptouch_switch_toggle|wpmp_switcher) [NC]

    RewriteCond %{REQUEST_URI} \/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)(.*)$
    RewriteCond "%{DOCUMENT_ROOT}/blog/wp-content/wfcache/%{HTTP_HOST}_%1/%2~%3~%4~%5~%6_wfcache%{ENV:WRDFNC_HTTPS}.html%{ENV:WRDFNC_ENC}" -f
    RewriteRule \/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)(.*)$ "/blog/wp-content/wfcache/%{HTTP_HOST}_blog/$1~$2~$3~$4~$5_wfcache%{ENV:WRDFNC_HTTPS}.html%{ENV:WRDFNC_ENC}" [L]
</IfModule>
#Do not remove this line. Disable Web caching in Wordfence to remove this data -     WFCACHECODE
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

# END WordPress


# prevent comment posting to requests with no referer
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*elearnenglishlanguage.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://www.elearnenglishlanguage.com/blog/$ [R=301,L]
重新编写引擎打开
重写cond%{THE_REQUEST}^[A-Z]{3,}\s/+(.*)%7Bjass_域名%7D/jass/jass\.js\?cb=47\sHTTP[NC]
是否重写规则^/%1?[L,NE,R=302]
#WFIPBLOCKS-请勿删除此行。在Wordfence中禁用Web缓存以删除此数据。
命令拒绝,允许
从54.74.250.230开始拒绝
从54.177.48.98开始拒绝
从54.177.53.123开始拒绝
从54.170.232.157开始拒绝
#不要拆下这条线。在Wordfence中禁用Web缓存以删除此数据-WFIPBLOCKS
#WFCACHECODE-不要删除此行。在Wordfence中禁用Web缓存以删除此数据。
AddOutputFilterByType DEFLATE text/css text/x-component应用程序/x-javascript应用程序/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon应用程序/json
标头附加变量用户代理env=!不要改变
AddOutputFilter DEFLATE js css htm html xml
AddType text/html.html\u gzip
AddEncoding gzip.html\u gzip
AddType text/xml.xml\u gzip
AddEncoding gzip.xml\u gzip
setEnvifLocase请求\u URI\.html\u gzip$no gzip
setEnvifLocase请求\u URI\.xml\u gzip$no gzip
标题集“接受编码,Cookie”
#如果没有默认字符集,则防止缓存文件中出现乱码字符。
AddDefaultCharset utf-8
#缓存规则:
重新启动发动机
重写基/
在上重写cond%{HTTPS}
重写规则。*-[E=WRDFNC_HTTPS:_HTTPS]
RewriteCond%{HTTP:Accept Encoding}gzip
重写规则。*-[E=WRDFNC\U ENC:\U gzip]
重写cond%{REQUEST_METHOD}=邮递
重写条件%{HTTPS}关闭
重写cond%{QUERY_STRING}^(?:\d+=\d+$
RewriteCond%{REQUEST\u URI}(?:\/\.html)$[NC]
重写cond%{HTTP_COOKIE}!(注释|作者| wp \-postpass | wf |注销| wordpress |登录| wptouch |开关| wpmp |开关)[NC]
重写条件%{REQUEST\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*(.*))$
重写第二个“%{DOCUMENT_ROOT}/blog/wp content/wfcache/%{HTTP_HOST}}1/%2~%3~%4~%5~%6_wfcache%{ENV:WRDFNC_HTTPS}.html%{ENV:WRDFNC_ENC}”-f
重写规则\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*([^\/]*)\/*(.*)“/blog/wp content/wfcache/%{HTTP\u HOST}blog/$1~$2~$3~$4~$5wfcache%{ENV:WRDFNC\u HTTPS}.html%{ENV:WRDFNC\u ENC
#不要拆下这条线。在Wordfence中禁用Web缓存以删除此数据-WFCACHECODE
#开始WordPress
重新启动发动机
重写库/博客/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/blog/index.php[L]
#结束WordPress
#禁止向没有推荐人的请求发布评论
重新启动发动机
重写cond%{REQUEST_METHOD}POST
RewriteCond%{REQUEST_URI}.wp comments post\.php*
重写cond%{HTTP_REFERER}*elearnenglishlanguage.com.*[或]
RewriteCond%{HTTP_USER_AGENT}^$
重写规则(.*)^http://www.elearnenglishlanguage.com/blog/$[R=301,L]

您可以将此规则用作
文档根目录中的第一条规则。htaccess
文件:

RewriteEngine On

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.*?)%7Bjass_domain_name%7D/jass/jass\.js\?cb=47\sHTTP [NC]
RewriteRule ^ /%1? [L,NE,R=302]

什么是原始URL,什么应该是最终URL?它是我网站上的任何URL,例如
http://www.elearnenglishlanguage.com/blog/{jass_domain_name}/jass/jass.js?cb=47
我希望它删除所有jass内容,然后转到真正的url:
http://www.elearnenglishlanguage.com/blog/
谢谢,但这仍然给了我同样的错误:
try{console.log(“-error-Original site javascript不存在。这是一个占位符”);}catch(e){}
这是在我的Apache上正确测试的规则。你在
/blog/
中也有.htaccess吗?是的,我有。我应该将此代码放在/blog/.htaccess中吗?是的,这是正确的,此规则应该放在
/blog/.htaccess
中作为第一条规则,无论是在/blog/还是/blog/中,我都会遇到相同的错误,因此显然我的站点/服务器上有一个更大的问题需要首先解决。谢谢您的尝试。:-)