I'm trying to make a 410 (gone) to all com_k2 links that for some reason are pointing towards my site, but the WordPress part of htaccess (I mean # BEGIN WordPress - # END WordPress) overrides it and I can't make it work.
This is what I have at the top of site:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^www.mypage.com
RewriteCond %{QUERY_STRING} com_k2 [NC]
RewriteRule ^ - [G,L]
then at the bottom WP makes this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
The pattern is this:
https://www.mypage.com/?option=com_k2&view=itemlist&task=user&id=5640
I'm no htaccess expert so... help!
This is the full htaccess:
# BEGIN WpFastestCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?mitza\.es
RewriteCond %{QUERY_STRING} com_k2 [NC]
RewriteRule ^ - [G]
# Start WPFC Exclude
# End WPFC Exclude
# Start_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=mitza#mitza.es
# End_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP_HOST} ^www.mitza.es
RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WhatsApp|Mediatoolkitbot)
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{REQUEST_URI} !(\/){2}$
RewriteCond %{QUERY_STRING} !.+
RewriteCond %{HTTP:Cookie} !comment_author_
RewriteCond %{HTTP:Cookie} !wp_woocommerce_session
RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or]
RewriteCond /home/mitzaes/public_html/wp-content/cache/all/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L]
</IfModule>
<FilesMatch "index\.(html|htm)$">
AddDefaultCharset UTF-8
<ifModule mod_headers.c>
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT"
</ifModule>
</FilesMatch>
# END WpFastestCache
# BEGIN GzipWpFastestCache
<IfModule mod_deflate.c>
AddType x-font/woff .woff
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf
</IfModule>
# END GzipWpFastestCache
# BEGIN LBCWpFastestCache
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\.gz)?$">
<IfModule mod_expires.c>
AddType application/font-woff2 .woff2
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/webp A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType image/svg+xml A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
ExpiresByType application/javascript A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType application/font-woff2 A2592000
</IfModule>
<IfModule mod_headers.c>
Header set Expires "max-age=2592000, public"
Header unset ETag
Header set Connection keep-alive
FileETag None
</IfModule>
</FilesMatch>
# END LBCWpFastestCache
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# BEGIN Brute Force Login Protection
<FilesMatch ".*\.(php|html?|css|js|jpe?g|png|gif)$">
order deny,allow
deny from 91.200.12.22
deny from 91.200.12.91
deny from 2607:f298:5:101b::61e:49ae
</FilesMatch>
# END Brute Force Login Protection
RewriteEngine on
Redirect 301 /nuevo-nicehash-miner-legacy https://www.mitza.es/noticias/nuevo-nicehash-miner-legacy
Redirect 301 /secciones/bitcoin/ https://www.mitza.es/zonas/paginas-web-valdemoro
Redirect 301 /secciones/litecoin/ https://www.mitza.es/zonas/paginas-web-valdemoro
Redirect 301 /portfolio/gibson-guitars/ https://www.mitza.es/zonas/paginas-web-valdemoro
Redirect 301 /portfolio/nex7-workspace/ https://www.mitza.es/zonas/paginas-web-valdemoro
Redirect 301 /how-videos-can-help-promote-your-business/ https://www.mitza.es/zonas/paginas-web-valdemoro
Redirect 301 /working-like-a-workaholic/ https://www.mitza.es/zonas/paginas-web-valdemoro
Redirect 301 /portfolio/focus-lab/ https://www.mitza.es/zonas/paginas-web-valdemoro
Redirect 301 /portfolio/outdoor-photoshoot/ https://www.mitza.es/zonas/paginas-web-valdemoro
Redirect 301 /portfolio/l-a-p-d-1947/ https://www.mitza.es/zonas/paginas-web-valdemoro
Redirect 301 /audio-post/ https://www.mitza.es/zonas/paginas-web-valdemoro
Redirect 301 /perfect-sunday-morning-ride/ https://www.mitza.es/zonas/paginas-web-valdemoro
Redirect 301 /secciones/noticias/ https://www.mitza.es/noticias
#2
Redirect 301 /logic-will-get-you-from-a-to-b/ https://www.mitza.es/
Redirect 301 /component/content/article/2-uncategorised/80-para-costi https://www.mitza.es
Redirect 301 /role-of-size-in-logo-design/ https://www.mitza.es/
Redirect 301 /portfolio/its-summer-time/ https://www.mitza.es/
Redirect 301 /portfolio/maybe-one-day-fashion/ https://www.mitza.es/
Redirect 301 /hello-world-2/ https://www.mitza.es/
Redirect 301 /hola-mundo/ https://www.mitza.es/
Redirect 301 /try-me https://www.mitza.es/
Redirect 301 /poze-cu-elsa https://www.mitza.es/
Redirect 301 /portfolio/sea-side-store/ https://www.mitza.es/
Redirect 301 /portfolio/time-is-nothing/ https://www.mitza.es/
Redirect 301 /category/noticias https://www.mitza.es/
# BEGIN WP Performance Score Booster Settings
# END WP Performance Score Booster Settings
Redirect 301 /case-study-envato-website-redesign/ https://www.mitza.es/
# This line :
RewriteCond %{HTTP_HOST} ^www.mypage.com
You should escape spacial character like this :
RewriteCond %{HTTP_HOST} ^www\.mypage\.com
If you want to match both www or non-www replace with this :
RewriteCond %{HTTP_HOST} ^(www\.)?mypage\.com
Related
I'm trying to configure new .htaccess file and everything seems to be working except HTTP redirect to HTTPS.
I've tried
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
But it didn't work. Here's my full .htaccess file in it's current form.
<Files .htaccess>
order allow,deny
deny from all
</Files>
# Add Caching
<FilesMatch "\.(png|gif|js|css)$">
ExpiresActive on
ExpiresDefault "access plus 1 month"
</FilesMatch>
# disable directory autoindexing
Options -Indexes
RewriteEngine On
# https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# BEGIN GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
# END GZIP
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect to domain without www. for HTTPS:
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule .* https://%1%{REQUEST_URI} [R=301,L]
# Stop hotlinking.
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} ^https?://([^/]+)/ [NC]
RewriteCond %1#%{HTTP_HOST} !^(.+)#\1$
RewriteRule \.(jpg|jpeg|png|gif|swf|svg)$ - [NC,F,L]
# Prevent viewing of htaccess file.
<Files .htaccess>
order allow,deny
deny from all
</Files>
# Compress text, html, javascript, css, 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
What am I missing?
Depending on your Host/Server configuration try
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
or
RewriteCond %{HTTPS} off
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [L,R=301]
I have problem with my htaccess file.
My main domain kielkowski-szkolka.pl points to root folder
/kielkowski-szkolka.pl/public_html
Now, I created subdomain automatyka.kielkowski-szkolka.pl with points to /kielkowski-szkolka.pl/public_html/automatyka
Now when I try to go to automatyka.kielkowski-szkolka.pl it redirects me to / of my main domain, kielkowski-szkolka.pl
Can you look my root htaccess and tell me what to add/change to make it work?
SetEnv PHP_VER 5
php_flag apc.enabled On
php_flag apc.cache_by_default On
php_value session.gc_maxlifetime 86400
php_value session.cookie_lifetime 86400
Options +FollowSymLinks
# compress text, html, javascript, css, 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
#przekierowanie z http na https i z ww na bez www
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^kielkowski-szkolka.pl [NC]
RewriteRule ^(.*)$ https://kielkowski-szkolka.pl%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} !^on$
RewriteRule ^(.*)$ https://kielkowski-szkolka.pl/$1 [R=301,L]
# Redirect non-existing files or folders to index
# Redirect non-existing files or folders to index
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ / [L,QSA,R=301]
</IfModule>
You can check for your subdomain and then redirect to the folder like this for example.
RewriteCond %{HTTP_HOST} ^automatyka\.kielkowski-szkolka\.pl$
RewriteRule ^(.*)$ http://kielkowski-szkolka.pl/automatyka/$1 [L,R=301]
i have following problem, i cant Redirect 301 via .htaccess example:
Redirect 301 /wellnesshotel.php/fotogalerie/ /wellnesshotel/bilder-und-videos/
the page where the redirection comes is http://www.domain.de//fotogalerie/ but why?
Thanks a lot
`
# BEGIN HTTPS Redirection Plugin
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# END HTTPS Redirection Plugin
# BEGIN WpFastestCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^www.my-domain.de
# Start WPFC Exclude
RewriteCond %{REQUEST_URI} !wellnessurlaub/wellness-angebote [NC]
# End WPFC Exclude
# Start_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=Anke|Buckermann|MarcelM|Mudrich|Steffen
RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=Taptap|Tina|Tobias|Valentin|Walera
RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=Xenia
# End_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP_HOST} ^www.my-domain.de
RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WhatsApp|Mediatoolkitbot)
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{REQUEST_URI} !(\/){2}$
RewriteCond %{REQUEST_URI} \/$
RewriteCond %{QUERY_STRING} !.+
RewriteCond %{HTTP:Cookie} !comment_author_
RewriteCond %{HTTP:Cookie} !wp_woocommerce_session
RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP_USER_AGENT} !^.*(\bCrMo\b|CriOS|Android.*Chrome\/[.0-9]*\s(Mobile)?|\bDolfin\b|Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR\/[0-9.]+|Coast\/[0-9.]+|Skyfire|Mobile\sSafari\/[.0-9]*\sEdge|IEMobile|MSIEMobile|fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile|FxiOS|bolt|teashark|Blazer|Version.*Mobile.*Safari|Safari.*Mobile|MobileSafari|Tizen|UC.*Browser|UCWEB|baiduboxapp|baidubrowser|DiigoBrowser|Puffin|\bMercury\b|Obigo|NF-Browser|NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger|Android.*PaleMoon|Mobile.*PaleMoon|Android|blackberry|\bBB10\b|rim\stablet\sos|PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino|Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\bS60\b|Windows\sCE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Window\sMobile|Windows\sPhone\s[0-9.]+|WCE;|Windows\sPhone\s10.0|Windows\sPhone\s8.1|Windows\sPhone\s8.0|Windows\sPhone\sOS|XBLWP7|ZuneWP7|Windows\sNT\s6\.[23]\;\sARM\;|\biPhone.*Mobile|\biPod|\biPad|Apple-iPhone7C2|MeeGo|Maemo|J2ME\/|\bMIDP\b|\bCLDC\b|webOS|hpwOS|\bBada\b|BREW).*$ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or]
RewriteCond /usr/www/users/zumckp/ice-media/wp-content/cache/all/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L]
##### mobile #####
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^www.my-domain.de
# Start WPFC Exclude
RewriteCond %{REQUEST_URI} !wellnessurlaub/wellness-angebote [NC]
# End WPFC Exclude
# Start_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=Anke|Buckermann|MarcelM|Mudrich|Steffen
RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=Taptap|Tina|Tobias|Valentin|Walera
RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=Xenia
# End_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP_HOST} ^www.my-domain.de
RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WhatsApp|Mediatoolkitbot)
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{REQUEST_URI} !(\/){2}$
RewriteCond %{REQUEST_URI} \/$
RewriteCond %{QUERY_STRING} !.+
RewriteCond %{HTTP:Cookie} !comment_author_
RewriteCond %{HTTP:Cookie} !wp_woocommerce_session
RewriteCond %{HTTP:Cookie} !safirmobilswitcher=masaustu
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP_USER_AGENT} ^.*(\bCrMo\b|CriOS|Android.*Chrome\/[.0-9]*\s(Mobile)?|\bDolfin\b|Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR\/[0-9.]+|Coast\/[0-9.]+|Skyfire|Mobile\sSafari\/[.0-9]*\sEdge|IEMobile|MSIEMobile|fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile|FxiOS|bolt|teashark|Blazer|Version.*Mobile.*Safari|Safari.*Mobile|MobileSafari|Tizen|UC.*Browser|UCWEB|baiduboxapp|baidubrowser|DiigoBrowser|Puffin|\bMercury\b|Obigo|NF-Browser|NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger|Android.*PaleMoon|Mobile.*PaleMoon|Android|blackberry|\bBB10\b|rim\stablet\sos|PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino|Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\bS60\b|Windows\sCE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Window\sMobile|Windows\sPhone\s[0-9.]+|WCE;|Windows\sPhone\s10.0|Windows\sPhone\s8.1|Windows\sPhone\s8.0|Windows\sPhone\sOS|XBLWP7|ZuneWP7|Windows\sNT\s6\.[23]\;\sARM\;|\biPhone.*Mobile|\biPod|\biPad|Apple-iPhone7C2|MeeGo|Maemo|J2ME\/|\bMIDP\b|\bCLDC\b|webOS|hpwOS|\bBada\b|BREW).*$ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/wpfc-mobile-cache/$1/index.html -f [or]
RewriteCond /usr/www/users/zumckp/ice-media/wp-content/cache/wpfc-mobile-cache/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/wpfc-mobile-cache/$1/index.html" [L]
##### mobile #####
</IfModule>
<FilesMatch "index\.(html|htm)$">
AddDefaultCharset UTF-8
<ifModule mod_headers.c>
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT"
</ifModule>
</FilesMatch>
# END WpFastestCache
# BEGIN GzipWpFastestCache
<IfModule mod_deflate.c>
AddType x-font/woff .woff
AddType x-font/ttf .ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf
</IfModule>
# END GzipWpFastestCache
# BEGIN LBCWpFastestCache
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\.gz)?$">
<IfModule mod_expires.c>
AddType application/font-woff2 .woff2
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/webp A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType image/svg+xml A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
ExpiresByType application/javascript A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType application/font-woff2 A2592000
</IfModule>
<IfModule mod_headers.c>
Header set Expires "max-age=2592000, public"
Header unset ETag
Header set Connection keep-alive
FileETag None
</IfModule>
</FilesMatch>
# END LBCWpFastestCache
# BEGIN WEBPWpFastestCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_URI} \.(jpe?g|png)
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f [or]
RewriteCond /usr/www/users/zumckp/ice-media/$1.webp -f
RewriteRule ^(.*) "/$1.webp" [L]
</IfModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>
AddType image/webp .webp
# END WEBPWpFastestCache
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# WORKING REDIRECTS
RewriteEngine On
Redirect 301 /hotel/wellnessurlaub.php/bernkastel-kues /kontakt-infomationen/service/hotel-faqs-von-a-z/
Redirect 301 /wellness/wellnessreisen.php/verwoehnhotel /wellnesshotel/bilder-und-videos/
Redirect 301 /hotel-buchen/wellnesshotel.php/hotel/angebote-pauschalen.html /wellnessurlaub/
Redirect 301 /hotel-buchen/wellnesshotel.php/hotel/zimmer /wellnessurlaub/zimmer/
Redirect 301 /hotel-buchen/wellnesshotel.php/hotel/anwendungen/ /wellnessurlaub/anwendungen/
Redirect 301 /dayspa/ /wellnessurlaub/day-spa/
Redirect 301 /bewei/ /wellness/bewei/
Redirect 301 /tcm/traditionelle-chinesische-medizin.php/alternative-medizin /tcm/
Redirect 301 /beauty/medical-beauty.php/schoenheitsfarm /wellness/spa/
Redirect 301 /restaurant/vitalhotel.php/fuenf-elemente-kueche /wellnesshotel/kulinarik/
Redirect 301 /freizeit/fitness-hotel.php/ferien/ /wellnesshotel/mosel-und-freizeit/wander-und-spazierwege-ab-hotel/
Redirect 301 /aktuelles/urlaub-deutschland.php/mosel/ /wellnesshotel/ueber-uns/news/
Redirect 301 /videos/ /wellnesshotel/bilder-und-videos/
Redirect 301 /wellness-abc/ https://www.my-domain.de/wellness/wellness-abc/
Redirect 301 /urlaub/rueckruf-service/ /kontakt-infomationen/kontakt/
Redirect 301 /wellnesshotel.php/urlaub/rueckruf-service/ /kontakt-infomationen/kontakt/
Redirect 301 /wellnesshotel.php/urlaub/anreise /wellnesshotel/anreise-und-entfernungen/
Redirect 301 /wellness-abc/ /wellness/wellness-abc/
Redirect 301 /angebote /wellnessurlaub/wellness-angebote/
Redirect 301 /wellnesshotel.php/urlaub/gaestebuch/gaestebuch /
Redirect 301 /wellnesshotel.php/angebote /wellnessurlaub/wellness-angebote/
Redirect 301 /wellnesshotel.php/urlaub/kontakt /kontakt-infomationen/kontakt/
Redirect 301 /wellnesshotel.php/urlaub/gutschein/ /wellnessurlaub/wellness-gutschein/
Redirect 301 /wellnesshotel.php/urlaub/wellnesshotel-prospekte/ /kontakt-infomationen/service/wellnesshotel-prospekte/
Redirect 301 /wellnesshotel.php/urlaub/uebersicht /sitemap/
Redirect 301 /wellnesshotel.php/urlaub/impressum /impressum/
Redirect 301 /wellnesshotel.php/urlaub/presse-center /kontakt-infomationen/kontakt/
Redirect 301 /wellnesshotel.php/urlaub/shops /tcm/shop/
Redirect 301 /wellnesshotel.php/urlaub/newsletter /kontakt-infomationen/service/newsletter/
Redirect 301 /angebote-und-preise/wellness.php/wellness-angebote/ /wellnessurlaub/wellness-angebote/
Redirect 301 /angebote-und-preise/wellness.php/wellness-angebote /wellnessurlaub/wellness-angebote/
# NOT WORKING REDIRECTS
RewriteEngine On
Redirect 301 /hotel/wellnessurlaub.php/bernkastel-kues/blackvip-im-wellnesshotel-zum-kurfuersten /kontakt-infomationen/service/black-vip/
Redirect 301 /aktuelles/urlaub-deutschland.php/mosel/stellenangebote/ /wellnesshotel/ueber-uns/jobs/
Redirect 301 /hotel/wellnessurlaub.php/bernkastel-kues/nachhaltigkeit /wellnesshotel/ueber-uns/nachhaltigkeit
Redirect 301 /hotel/wellnessurlaub.php/bernkastel-kues/ausstattungsmerkmale /kontakt-infomationen/service/hotel-faqs-von-a-z/
Redirect 301 /hotel/wellnessurlaub.php/bernkastel-kues/serviceleistungen /kontakt-infomationen/service/hotel-faqs-von-a-z/
Redirect 301 /hotel/wellnessurlaub.php/bernkastel-kues/gesellschaftliches-und-soziales-engagement /wellnesshotel/ueber-uns/nachhaltigkeit/
Redirect 301 /hotel/wellnessurlaub.php/bernkastel-kues/entfernungen /kontakt-infomationen/service/hotel-faqs-von-a-z/
Redirect 301 /angebote-und-preise/wellness.php/wellness-angebote/hotel/an-und-abreise /kontakt-infomationen/service/hotel-faqs-von-a-z/
Redirect 301 /angebote-und-preise/wellness.php/wellness-angebote/hotel/bezahlung-storno /kontakt-infomationen/service/hotel-faqs-von-a-z/
Redirect 301 /angebote-und-preise/wellness.php/wellness-angebote/hotel/saisonzeiten /kontakt-infomationen/service/hotel-faqs-von-a-z/
Redirect 301 /angebote-und-preise/wellness.php/wellness-angebote/hotel/fruehstueckszeiten /kontakt-infomationen/service/hotel-faqs-von-a-z/
Redirect 301 /angebote-und-preise/wellness.php/wellness-angebote/hotel/fuer-kinder /kontakt-infomationen/service/hotel-faqs-von-a-z/
Redirect 301 /angebote-und-preise/wellness.php/wellness-angebote/hotel/hunde-mitbringen /kontakt-infomationen/service/hotel-faqs-von-a-z/
Redirect 301 /angebote-und-preise/wellness.php/wellness-angebote/hotel/unsere-kueche /wellnesshotel/kulinarik/
Redirect 301 /angebote-und-preise/wellness.php/wellness-angebote/hotel/wissenswertes /kontakt-infomationen/service/hotel-faqs-von-a-z/
Redirect 301 /restaurant/vitalhotel.php/fuenf-elemente-kueche/gutes-essen-haelt-leib-und-seele-zusammen /wellnesshotel/kulinarik
Redirect 301 /restaurant/vitalhotel.php/fuenf-elemente-kueche/waffelrezept-ein-bisschen-gesund /wellnesshotel/kulinarik/
Redirect 301 /restaurant/vitalhotel.php/fuenf-elemente-kueche/speisekarte-mittag /wellnesshotel/kulinarik/
Redirect 301 /restaurant/vitalhotel.php/fuenf-elemente-kueche/speisekarte-abend /wellnesshotel/kulinarik/
Redirect 301 /restaurant/vitalhotel.php/fuenf-elemente-kueche/vital-schlemmen /wellnesshotel/kulinarik/
Redirect 301 /restaurant/vitalhotel.php/fuenf-elemente-kueche/einzigartige-kueche /wellnesshotel/kulinarik/
Redirect 301 /wellness/wellnessreisen.php/verwoehnhotel/tcm-wellness-abc /tcm/alternative-medizin/tcm-glossar/
Redirect 301 /wellness/wellnessreisen.php/verwoehnhotel/praeventionsangebote /kontakt-infomationen/service/hotel-faqs-von-a-z/
Redirect 301 /wellness/wellnessreisen.php/verwoehnhotel/wellnessurlaub-mosel /wellnesshotel/mosel-und-freizeit/
Redirect 301 /wellness/wellnessreisen.php/verwoehnhotel/fitness-cardio-fitness /wellness/kurse-aktivitaeten/fitness/
Redirect 301 /wellness/wellnessreisen.php/verwoehnhotel/praeventions-kurse /kontakt-infomationen/service/hotel-faqs-von-a-z/
Redirect 301 /wellness/wellnessreisen.php/verwoehnhotel/panorama-schwimmbad /
Redirect 301 /wellness/wellnessreisen.php/verwoehnhotel/wellness-im-hotel-zum-kurfuersten /
Redirect 301 /wellness/wellnessreisen.php/verwoehnhotel/zuschuesse /kontakt-infomationen/service/hotel-faqs-von-a-z/
Redirect 301 /wellness/wellnessreisen.php/verwoehnhotel/wellness-hotels-resorts /kontakt-infomationen/service/hotel-faqs-von-a-z/
# enable php compression
php_value zlib.output_compression 1
php_value zlib.output_compression_level 6
# enable apache compression
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE application/* text/* font/* image/x-icon image/svg+xml
</IfModule>
</IfModule>`
I've followed this: Mode Rewrite; with/without trailing slash on end of url? solution but it's not working out for my mybb site. I've tried adding it in the top and in the bottom of .htaccess ... but not working.
What could I be missing?
Here is my .htaccess, I've substitute mysite with example.com:
Options -MultiViews +FollowSymlinks -Indexes
<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off
# The below probably isn't needed, but better safe than sorry.
SecFilterScanPOST Off
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RedirectMatch 301 ^/archive/index\.php/?(.*) /$1
# Some hosts need a RewriteBase specification.
RewriteBase /
# Google SEO workaround for search.php highlights:
# Make this rule the first rewrite rule in your .htaccess!
RewriteRule ^([^&]*)&(.*)$ http://forum.example.com/$1?$2 [L,QSA,R=301]
# Google SEO Sitemap:
RewriteRule ^sitemap-([^./]+)\.xml$ misc.php?google_seo_sitemap=$1 [L,QSA,NC]
# Google SEO URL Forums:
RewriteRule ^Forum-([^./]+)$ forumdisplay.php?google_seo_forum=$1 [L,QSA,NC]
# Google SEO URL Threads:
RewriteRule ^Thread-([^./]+)$ showthread.php?google_seo_thread=$1 [L,QSA,NC]
# Google SEO URL Announcements:
RewriteRule ^Announcement-([^./]+)$ announcements.php?google_seo_announcement=$1 [L,QSA,NC]
# Google SEO URL Users:
RewriteRule ^User-([^./]+)$ member.php?action=profile&google_seo_user=$1 [L,QSA,NC]
# Google SEO URL Calendars:
RewriteRule ^Calendar-([^./]+)$ calendar.php?google_seo_calendar=$1 [L,QSA,NC]
# Google SEO URL Events:
RewriteRule ^Event-([^./]+)$ calendar.php?action=event&google_seo_event=$1 [L,QSA,NC]
# Google SEO 404:
ErrorDocument 404 /misc.php?google_seo_error=404
# Default MyBB Rewrite Rules:
RewriteRule ^forum-([0-9]+)\.html$ forumdisplay.php?fid=$1 [L,QSA]
RewriteRule ^forum-([0-9]+)-page-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2 [L,QSA]
RewriteRule ^thread-([0-9]+)\.html$ showthread.php?tid=$1 [L,QSA]
RewriteRule ^thread-([0-9]+)-page-([0-9]+)\.html$ showthread.php?tid=$1&page=$2 [L,QSA]
RewriteRule ^thread-([0-9]+)-lastpost\.html$ showthread.php?tid=$1&action=lastpost [L,QSA]
RewriteRule ^thread-([0-9]+)-nextnewest\.html$ showthread.php?tid=$1&action=nextnewest [L,QSA]
RewriteRule ^thread-([0-9]+)-nextoldest\.html$ showthread.php?tid=$1&action=nextoldest [L,QSA]
RewriteRule ^thread-([0-9]+)-newpost\.html$ showthread.php?tid=$1&action=newpost [L,QSA]
RewriteRule ^thread-([0-9]+)-post-([0-9]+)\.html$ showthread.php?tid=$1&pid=$2 [L,QSA]
RewriteRule ^post-([0-9]+)\.html$ showthread.php?pid=$1 [L,QSA]
RewriteRule ^announcement-([0-9]+)\.html$ announcements.php?aid=$1 [L,QSA]
RewriteRule ^user-([0-9]+)\.html$ member.php?action=profile&uid=$1 [L,QSA]
RewriteRule ^calendar-([0-9]+)\.html$ calendar.php?calendar=$1 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)\.html$ calendar.php?action=yearview&calendar=$1&year=$2 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ calendar.php?calendar=$1&year=$2&month=$3 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4 [L,QSA]
RewriteRule ^calendar-([0-9]+)-week-(n?[0-9]+)\.html$ calendar.php?action=weekview&calendar=$1&week=$2 [L,QSA]
RewriteRule ^event-([0-9]+)\.html$ calendar.php?action=event&eid=$1 [L,QSA]
<IfModule mod_env.c>
SetEnv SEO_SUPPORT 1
</IfModule>
#Added by Anurag
RewriteRule ^index\.php(.*)$ http://%{HTTP_HOST}$1 [L,R=301]
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/x-javascript text/css text/html text/xml
</IfModule>
AddType text/javascript .js
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 800000 seconds"
ExpiresByType image/jpeg "access plus 800000 seconds"
ExpiresByType image/png "access plus 800000 seconds"
ExpiresByType image/gif "access plus 800000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 800000 seconds"
ExpiresByType text/css "access plus 800000 seconds"
ExpiresByType text/javascript "access plus 800000 seconds"
ExpiresByType application/x-javascript "access plus 800000 seconds"
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\\.(ico|jpe?g|png|gif|swf|css|js)$">
Header set Cache-Control "max-age=800000, public"
</FilesMatch>
Header unset ETag
Header unset Last-Modified
</IfModule>
RewriteRule ^(.*)/$ /$1 [L,R=301]
Try adding this rule just below RewriteBase / line:
# remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} \s.+?/+[?\s]
RewriteRule ^(.+?)/$ /$1 [R=301,L,NE]
I'm using Apache web server ( use .htaccess to handle URL Rewrite ).
the main domain ( e.g. example.com ) is managed by URL Rewrite generated by WordPress. The URL Rewrite applies for whole domain , including sub-domains.
I have a new subdomain called http://static.example.com, which acts a URL forward to another external URL, e.g. forward to http://www.google.com. That's :
http://static.example.com/style.css will forward to http://www.google.com/css/some_path/style.css
However, the URL Rewrite blocks it, and reports file not found, as it cannot find the /css/style.css in local server. My question is: How to disable URL Rewrite for subdomain ?
The current .htaccess is as follow:
RewriteEngine on
AddType application/rss+xml rss
AddType application/x-java-jnlp-file jnlp
Options All -Indexes
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^/?$ "http\:\/\/example\.com" [R=301,L]
# BEGIN W3TC Browser Cache
<IfModule mod_deflate.c>
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
</IfModule>
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_mime.c>
# DEFLATE by extension
AddOutputFilter DEFLATE js css htm html xml
</IfModule>
</IfModule>
<FilesMatch "\.(css|htc|js|js2|js3|js4|CSS|HTC|JS|JS2|JS3|JS4)$">
<IfModule mod_headers.c>
Header set X-Powered-By "W3 Total Cache/0.9.2.11"
</IfModule>
</FilesMatch>
<FilesMatch "\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|SVG|SVGZ|TXT|XSD|XSL|XML)$">
<IfModule mod_headers.c>
Header set X-Powered-By "W3 Total Cache/0.9.2.11"
</IfModule>
</FilesMatch>
<FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|AVI|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|JSON|MDB|MID|MIDI|MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|MPP|OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|WAV|WMA|WRI|XLA|XLS|XLSX|XLT|XLW|ZIP)$">
<IfModule mod_headers.c>
Header set X-Powered-By "W3 Total Cache/0.9.2.11"
</IfModule>
</FilesMatch>
# END W3TC Browser Cache
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteCond %{HTTP_HOST} ^static\.example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.static\.example\.com$
RewriteRule ^/?$ "https\:\/\/google\.com\/css\/some_path\/" [R=301,L]
Note: note that the forwarding is actually included above.
p.s. all URLs are fake.
replace
RewriteCond %{HTTP_HOST} ^static\.example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.static\.example\.com$
RewriteRule ^/?$ "https\:\/\/google\.com\/css\/some_path\/" [R=301,L]
with
RewriteCond %{HTTP_HOST} ^(www\.)?static\.example\.com$
RewriteRule ^(.*)$ https://google.com/css/some_path/$1 [R=301,L]
the whole htaccess would be: (adjusted)
RewriteEngine on
AddType application/rss+xml rss
AddType application/x-java-jnlp-file jnlp
Options All -Indexes
# BEGIN W3TC Browser Cache
<IfModule mod_deflate.c>
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
</IfModule>
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_mime.c>
# DEFLATE by extension
AddOutputFilter DEFLATE js css htm html xml
</IfModule>
</IfModule>
<FilesMatch "\.(css|htc|js|js2|js3|js4|CSS|HTC|JS|JS2|JS3|JS4)$">
<IfModule mod_headers.c>
Header set X-Powered-By "W3 Total Cache/0.9.2.11"
</IfModule>
</FilesMatch>
<FilesMatch "\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|SVG|SVGZ|TXT|XSD|XSL|XML)$">
<IfModule mod_headers.c>
Header set X-Powered-By "W3 Total Cache/0.9.2.11"
</IfModule>
</FilesMatch>
<FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|AVI|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|JSON|MDB|MID|MIDI|MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|MPP|OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|WAV|WMA|WRI|XLA|XLS|XLSX|XLT|XLW|ZIP)$">
<IfModule mod_headers.c>
Header set X-Powered-By "W3 Total Cache/0.9.2.11"
</IfModule>
</FilesMatch>
# END W3TC Browser Cache
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# redirect www.example.com/some to example.com/some
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.)?static\.example\.com$
RewriteRule ^(.*)$ https://google.com/css/some_path/$1 [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>