I want to use mod-rewrite to convert:
https://newbootstrap.com/quiz
to:
https://newbootstrap.com/index.php?url=quiz
This is my .htaccess:
Options +FollowSymlinks
Options -Indexes
AddType text/x-component .htc
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text\.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image\.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
#Запрет перехода с определенного сайта
#<IfModule mod_rewrite.c>
#RewriteEngine on
#RewriteCond %{HTTP_REFERER} bannedurl1.com [NC,OR]
#RewriteCond %{HTTP_REFERER} bannedurl2.com [NC,OR]
#RewriteRule .* - [F]
#</ifModule>
RewriteRule ^quiz$ /index.php?url=quiz [L]
Or if this is a generic rule for any request:
RewriteRule ^(.+)$ /index.php?url=$1 [L]
A complete .htaccess file to achieve this end would be:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /index.php?url=$1 [L]
</IfModule>
Related
Whit this code, the 404 redirect doesnt work. I dont get any error. If i type in an url that doesnt exists, i only get an empty white page.
Code updated:
<IfModule mod_rewrite.c>
RewriteBase /
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ htaccess.php?q=$1 [QSA]
</IfModule>
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
#RewriteEngine On
#RewriteCond %{HTTPS} !=on
#RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
#RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
#RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteEngine On
RewriteBase /
ErrorDocument 404 404.php/
RewriteCond %{REQUEST_URI} ^/404/$
RewriteRule ^(.*)$ 404.php [L]
Change ErrorDocument 404 /index.php to
RewriteEngine On
RewriteBase /
ErrorDocument 404 http://yourdomain.com/404.php/
RewriteCond %{REQUEST_URI} ^/404/$
RewriteRule ^(.*)$ /path/to/404.php [L]
The Rewrite rules map that URL to your 404.php script.
See this link for more information: http://httpd.apache.org/docs/current/mod/core.html#errordocument
I have two websites - I have made htaccess file same for both of them (each has diffent links of course). They are same. My goal is to redirect from non www to www. Now it works for the first website. For the second one it works too but only on /index, the rest of pages doesn't redirect. Any idea what the problem might be? I believe there is no mistake in htaccess as I checked it and they should be completely the same.
Files - it works for AAA, doesn't for BBB. Htaccess code below:
AAA SITE:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^domains/
RewriteCond %{REQUEST_URI} !^/domains/
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)$
RewriteCond %{DOCUMENT_ROOT}/domains/%2 -d
RewriteRule (.*) domains/%2/$1 [DPI]
RewriteCond %{REQUEST_URI} !^subdom/
RewriteCond %{REQUEST_URI} !^/subdom/
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)\.([^\.]*)\.([^\.]*)$
RewriteCond %{DOCUMENT_ROOT}/subdom/%2 -d
RewriteRule (.*) subdom/%2/$1 [DPI]
DirectoryIndex index.html
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^domains/[^/]+/(.+[^/])$ /$1/ [R]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^subdom/[^/]+/(.+[^/])$ /$1/ [R]
RewriteRule ^([^\.]+)$ $1.html [NC,L]
RewriteEngine On
RewriteBase /
## hide .html extension
# To externally redirect /dir/foo.html to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,L,NC]
## To internally redirect /dir/foo to /dir/foo.html
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteEngine On
RewriteCond %{HTTP_HOST} ^aaa\.net
RewriteRule (.*) https://www.aaa.net/$1 [R=301,QSA,L]
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
ErrorDocument 404 https://www.aaa.net/404page
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A600
ExpiresByType text/javascript A604800
ExpiresByType application/javascript A604800
ExpiresByType text/css A604800
ExpiresByType image/gif A604800
ExpiresByType image/png A604800
ExpiresByType image/jpeg A604800
ExpiresByType image/x-icon A604800
ExpiresByType text/html A60
</IfModule>
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
BBB SITE:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^domains/
RewriteCond %{REQUEST_URI} !^/domains/
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)$
RewriteCond %{DOCUMENT_ROOT}/domains/%2 -d
RewriteRule (.*) domains/%2/$1 [DPI]
RewriteCond %{REQUEST_URI} !^subdom/
RewriteCond %{REQUEST_URI} !^/subdom/
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)\.([^\.]*)\.([^\.]*)$
RewriteCond %{DOCUMENT_ROOT}/subdom/%2 -d
RewriteRule (.*) subdom/%2/$1 [DPI]
DirectoryIndex index.html
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^domains/[^/]+/(.+[^/])$ /$1/ [R]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^subdom/[^/]+/(.+[^/])$ /$1/ [R]
RewriteRule ^([^\.]+)$ $1.html [NC,L]
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
## hide .html extension
# To externally redirect /dir/foo.html to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,L,NC]
## To internally redirect /dir/foo to /dir/foo.html
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteEngine on
RewriteCond %{HTTP_HOST} ^bbb\.net
RewriteRule (.*) https://www.bbb.net/$1 [R=301,QSA,L]
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
ErrorDocument 404 https://www.bbb.net/404page
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A600
ExpiresByType text/javascript A604800
ExpiresByType application/javascript A604800
ExpiresByType text/css A604800
ExpiresByType image/gif A604800
ExpiresByType image/png A604800
ExpiresByType image/jpeg A604800
ExpiresByType image/x-icon A604800
ExpiresByType text/html A60
</IfModule>
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
For both sites (AAA & BBB), use the following:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?!www\.) [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
This translates as:
For every URI which does not start with www., rewrite the URI as:
http://www.[the-rest-of-the-domain][/the-rest-of-the-uri]
This is my url mysite.com/screenshot/a/b/c/imgname.pl.jpg
Whenever I go to this url it redirects to not found.
<IfModule mod_rewrite.c>
RewriteEngine On
Options -Multiviews
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^screenshot/(.*)$ /screenshot/tempthumb.jpg [NC,L]
#it looks like htaccess is taking my url as a .pl perl file.
#So This is what I have tried.
RewriteRule ^screenshot/(.*)(.)(pl.jpg)$ /screenshot/$1\.$3 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^page/(.*)$ ./page.php?permalink=$1 [L]
ErrorDocument 404 /404.php
ErrorDocument 403 /403.php
</IfModule>
<IfModule mod_deflate.c>
<filesMatch "\.(js|css|html|php)$">
SetOutputFilter DEFLATE
</filesMatch>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css text/javascript application/javascript
</IfModule>
Ehat could be the problem
My guess as to what the problem could be is it's trying to look for a file called, literally, pl.jpg. Try making it into *.pl.jpg?
In my htacess I have:
RewriteRule ^(users)/([a-z]+)$ users.php?action=$2
When I type the url : site.com/users/register/ (yes with the / at the end)
the website redirects me to : site.com/users.php/register/?action=register
What is it doing that? when it should not redirect at all.
Also, when I type the url : site.com/users/register it sends me to error page!
full code:
Header unset ETag
FileETag None
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A86400
ExpiresByType image/x-icon A2592000
ExpiresByType image/ico A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType text/css A2592000
ExpiresByType image/gif A604800
ExpiresByType image/png A604800
ExpiresByType image/jpeg A604800
ExpiresByType text/plain A604800
ExpiresByType application/x-shockwave-flash A604800
ExpiresByType video/x-flv A604800
ExpiresByType application/pdf A604800
ExpiresByType text/html A900
</IfModule>
<FilesMatch "\.(flv|gif|jpg|jpeg|png|ico|swf)$">
Header set Cache-Control "max-age=7257600"
</FilesMatch>
# 1 Week
<FilesMatch "\.(js|css|pdf|txt)$">
Header set Cache-Control "max-age=7257600"
</FilesMatch>
# 10 Minutes
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=3600"
</FilesMatch>
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
#Gzip
<ifmodule mod_deflate.c>
# compress text, HTML, JavaScript, CSS, and XML
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# remove browser bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</ifmodule>
#End Gzip
# NONE
<FilesMatch "\.(pl|php|cgi|spl)$">
Header unset Cache-Control
Header unset Expires
Header unset Last-Modified
FileETag None
Header unset Pragma
</FilesMatch>
ErrorDocument 404 http://www.site.ae
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(RSS)/([A-Z][a-zA-z0-9]+).xml$ rss.php?title=$2
RewriteRule ^(articles)/(.*)/$ article.php?s=$2
RewriteRule ^(articles)/(.*)/([0-9]+)$ article.php?s=$2&page=$3
RewriteRule ^(teams)/(.*)/$ teams.php?s=$2
RewriteRule ^(teams)/(.*)/([0-9]+)$ teams.php?s=$2&page=$3
RewriteRule ^(site)/(all)/$ site.php?s=$2
RewriteRule ^(site)/(all)/([0-9]+)$ site.php?s=$2&page=$3
RewriteRule ^(site)/(tag)/(.*)/(.*)/([A-Z]+)/([0-9]+)$ site.php?s=tag&orderby=$4&order=$5&tag=$3&page=$6
RewriteRule ^(site)/(.*)/(.*)/([A-Z]+)/([0-9]+)$ site.php?s=$2&orderby=$3&order=$4&page=$5
RewriteRule ^([A-Z][a-zA-z0-9]+)/?$ show_site.php?title=$1
RewriteRule ^([A-Z][a-zA-z0-9]+)/([0-9]+)/([0-9]+)/?$ show_chapter.php?title=$1&ch_num=$2&page=$3
RewriteRule ^([A-Z][a-zA-z0-9]+)/([0-9]+)/?$ show_chapter.php?title=$1&ch_num=$2&page=C
RewriteRule ^(t)/(.*)/$ team.php?t=$2
RewriteRule ^(t)/(.*)/([0-9]+)$ team.php?t=$2&page=$3
RewriteRule ^(contact)/?$ contact.php
RewriteRule ^(add)/(chapter)?$ addchapter.php
RewriteRule ^(add)/(site)?$ addsite.php
RewriteRule ^(add)/(info)?$ addinfo.php
RewriteRule ^(register)/?$ register.php
RewriteRule ^(user)/(.*)/$ usercp.php?page=favorite&user=$2
RewriteRule ^(my-list)/delete/([0-9]+)/$ usercp.php?page=delete&site=$2
RewriteRule ^(my-list)/add/([0-9]+)/$ usercp.php?page=add&site=$2
RewriteRule ^(review)/([A-Z][a-zA-z0-9]+)/$ addreview.php?m=$2
RewriteRule ^(users)/([a-z]+)$ users.php?action=$2
RewriteRule ^(showarticle)/([0-9]+)/$ showarticle.php?id=$2
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?siteat.com
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site.ae [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ http://i642.photobucket.com/albums/uu145/shnisaka/nohotlinking_zpsf5dd3133.jpg [NC,R,L]
RewriteCond %{HTTP_HOST} ^site.ae$
RewriteRule ^(.*)$ "http\:\/\/www\.site\.ae\/$1" [R=301,L]
More refined question:
RewriteRule ^(users)/(register)$ users.php?action=register [R=301,L]
should redirect from site.com/users.php?action=register to site.com/users/register right?
Keep your rule like this:
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?siteat\$.com
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site\.ae$ [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ http://i642.photobucket.com/albums/uu145/shnisaka/nohotlinking_zpsf5dd3133.jpg [NC,R,L]
RewriteCond %{HTTP_HOST} ^site\.ae$
RewriteRule ^(.*)$ http://www.site.ae/$1 [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^(RSS)/([A-Z][a-zA-z0-9]+).xml$ rss.php?title=$2 [L,QSA]
RewriteRule ^(articles)/(.*)/$ article.php?s=$2 [L,QSA]
RewriteRule ^(articles)/(.*)/([0-9]+)$ article.php?s=$2&page=$3 [L,QSA]
RewriteRule ^(teams)/(.*)/$ teams.php?s=$2 [L,QSA]
RewriteRule ^(teams)/(.*)/([0-9]+)$ teams.php?s=$2&page=$3 [L,QSA]
RewriteRule ^(site)/(all)/$ site.php?s=$2 [L,QSA]
RewriteRule ^(site)/(all)/([0-9]+)$ site.php?s=$2&page=$3 [L,QSA]
RewriteRule ^(site)/(tag)/(.*)/(.*)/([A-Z]+)/([0-9]+)$ site.php?s=tag&orderby=$4&order=$5&tag=$3&page=$6 [L,QSA]
RewriteRule ^(site)/(.*)/(.*)/([A-Z]+)/([0-9]+)$ site.php?s=$2&orderby=$3&order=$4&page=$5 [L,QSA]
RewriteRule ^([A-Z][a-zA-z0-9]+)/?$ show_site.php?title=$1 [L,QSA]
RewriteRule ^([A-Z][a-zA-z0-9]+)/([0-9]+)/([0-9]+)/?$ show_chapter.php?title=$1&ch_num=$2&page=$3 [L,QSA]
RewriteRule ^([A-Z][a-zA-z0-9]+)/([0-9]+)/?$ show_chapter.php?title=$1&ch_num=$2&page=C [L,QSA]
RewriteRule ^(t)/(.*)/$ team.php?t=$2 [L,QSA]
RewriteRule ^(t)/(.*)/([0-9]+)$ team.php?t=$2&page=$3 [L,QSA]
RewriteRule ^(contact)/?$ contact.php [L,QSA]
RewriteRule ^(add)/(chapter)?$ addchapter.php [L]
RewriteRule ^(add)/(site)?$ addsite.php [L]
RewriteRule ^(add)/(info)?$ addinfo.php [L]
RewriteRule ^(register)/?$ register.php [L]
RewriteRule ^(user)/(.*)/?$ usercp.php?page=favorite&user=$2 [L,QSA]
RewriteRule ^(my-list)/delete/([0-9]+)/?$ usercp.php?page=delete&site=$2 [L,QSA]
RewriteRule ^(my-list)/add/([0-9]+)/?$ usercp.php?page=add&site=$2 [L,QSA]
RewriteRule ^(review)/([A-Z][a-zA-z0-9]+)/?$ addreview.php?m=$2 [L,QSA]
RewriteRule ^(users)/([a-z]+)/?$ users.php?action=$2 [L,QSA]
RewriteRule ^(showarticle)/([0-9]+)/?$ showarticle.php?id=$2 [L,QSA]
RewriteRule ^users/([a-z]+)/?$ users.php?action=$1
RewriteRule ^users/activate/([a-zA-Z0-9]+)/([a-z]+)/?$ users.php?action=activate&Hash=$1&UserName=$2
RewriteCond %{THE_REQUEST} users\.php
RewriteRule ^users\.php - [F]
I had to delete my .htaccess and add this to it. It worked with no problems!
I can't figure out how to remove the string {jass_domain_name}/jass/jass.js?cb=47 from the end of my URLs using .htaccess. I've looked through a bunch of responses here and tried all of the following - they either crash the site or give me a js error.
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
Thanks in advance for any advice.
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]
You can use this rule as very first rule in your DOCUMENT_ROOT/.htaccess file:
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]