0

I've tried multiple blocks of code and none of them work, i.e.:

RewriteEngine on
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

and

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]

among others.

Here is the contents of htaccess file:

RewriteEngine on

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]


<Files 403.shtml>
order allow,deny
allow from all
</Files>




# TEMPORARILY DISALLOW SEARCH INDEXING
User-agent: *
Disallow: /


# 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
# Prevents directory listing
Options -Indexes


# BEGIN DEFLATE COMPRESSION
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
 AddOutputFilterByType DEFLATE application/javascript
 AddOutputFilterByType DEFLATE application/rss+xml
 AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
 AddOutputFilterByType DEFLATE application/x-font
 AddOutputFilterByType DEFLATE application/x-font-opentype
 AddOutputFilterByType DEFLATE application/x-font-otf
 AddOutputFilterByType DEFLATE application/x-font-truetype
 AddOutputFilterByType DEFLATE application/x-font-ttf
 AddOutputFilterByType DEFLATE application/x-javascript
 AddOutputFilterByType DEFLATE application/xhtml+xml
 AddOutputFilterByType DEFLATE application/xml
 AddOutputFilterByType DEFLATE font/opentype
 AddOutputFilterByType DEFLATE font/otf
 AddOutputFilterByType DEFLATE font/ttf
 AddOutputFilterByType DEFLATE image/svg+xml
 AddOutputFilterByType DEFLATE image/x-icon
 AddOutputFilterByType DEFLATE text/css
 AddOutputFilterByType DEFLATE text/html
 AddOutputFilterByType DEFLATE text/javascript
 AddOutputFilterByType DEFLATE text/plain
 AddOutputFilterByType DEFLATE text/xml
</IfModule>
# END DEFLATE COMPRESSION

   <ifModule mod_expires.c>
 ExpiresActive On
 ExpiresDefault "access plus 5 seconds"
 ExpiresByType image/x-icon "access plus 2592000 seconds"
 ExpiresByType image/jpeg "access plus 2592000 seconds"
 ExpiresByType image/png "access plus 2592000 seconds"
 ExpiresByType image/gif "access plus 2592000 seconds"
 ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
 ExpiresByType text/css "access plus 2592000 seconds"
 ExpiresByType text/javascript "access plus 2592000 seconds"
 ExpiresByType application/javascript "access plus 2592000 seconds"
 ExpiresByType application/x-javascript "access plus 2592000 seconds"
 ExpiresByType text/html "access plus 600 seconds"
 ExpiresByType application/xhtml+xml "access plus 600 seconds"
 </ifModule>


#Gzip Compression
<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>


#Protect htaccess file
<files ~ "^.*\.([Hh][Tt][Aa])">
order allow,deny
deny from all
satisfy all
</files>


ExpiresActive on

# Add a far future Expires header for fonts
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/x-font-opentype "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"

# Block spam IP's    

deny from 208.80.194.26
deny from 199.217.119.217
deny from 196.44.162.14
deny from 194.28.87.135
deny from 151.213.104.194
deny from 141.8.193.26
deny from 122.144.9.251
deny from 90.156.201.106 
deny from 88.152.196.9
deny from 82.146.63.24
deny from 82.146.62.183
deny from 81.177.139.93
deny from 181.65.101.189
deny from 122.150.67.57
deny from 190.195.174.151
deny from 202.59.224.56
deny from 105.101.150.31
deny from 92.111.57.75
deny from 97.92.162.132
deny from 88.109.139.18
deny from 27.147.226.76
deny from 83.132.173.100
deny from 85.73.91.157
deny from 174.2.81.222
deny from 190.122.146.5
deny from 75.74.10.220
deny from 99.8.78.131
deny from 196.207.91.111
deny from 41.218.19.132
deny from 99.8.78.131   
deny from 85.135.210.16
deny from 24.15.104.240
deny from 138.201.125.143
deny from 115.28.43.234
deny from 115.135.6.46
deny from 115.188.146.137
deny from 115.28.240.215
deny from 142.161.98.92
deny from 51.255.65.42
deny from 52.71.155.178
deny from 176.9.118.102
deny from 70.90.119.26
deny from 70.90.213.86
deny from 86.143.107.221
deny from 180.216.56.20


SetEnvIfNoCase Referer darodar.com, priceg.com, iedit.ilovevitaly.com, toddard.com, intained.com, icalc.ilovevitaly.com, ilovevitaly.co, co.lumb.co/, co.lumb.co, semalt.semalt.com, semalt.com, buttons-for-website.com, semalt.semalt.com, a.xtopoly.com, hulfingtonpost.com, forum.topic29421116.darodar.com, spamlink=yes

 Order allow,deny

 Allow from all

 Deny from env=spamlink


#AddType application/x-httpd-php53 .php

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php71” package as the default “PHP” programming language.
<IfModule mime_module>
  AddType application/x-httpd-ea-php71 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

Requirements:

  • Redirect from old site to new site and keep the url path the same
  • Redirect subdomains to a new path i.e. 'category.old-domain.com' > new-domain.com/category
  • Most efficient for SEO
  • HTTP + HTTPS from old domain to HTTPS on new domain

What am I missing? Thanks.

  • When you say they don”t work, what do you mean exactly? Do they do anything? Are the old and new domains pointing to different file systems? – MrWhite Jul 25 at 20:45
  • It doesn't do anything or respond, no changes. – JJ100 Jul 25 at 21:56
  • Presumably you don't have any other directives in the .htaccess file at the old host? In that case, have you confirmed that .htaccess files and mod_rewrite are enabled at the old host? Your first rule unconditionally redirects everything - so something should be happening. – MrWhite Jul 25 at 22:01
  • I don't have anything in the htaccess that would conflict with the 301, just have the regular Wordpress rewrite and image compression things like gzip.Also I have it above the Wordpress rewrite in the document, so should be no issue there. – JJ100 Jul 26 at 0:20
  • "the regular Wordpress rewrite and image compression things" - If you are redirecting everything to another domain/host then all those existing WordPress directives would seem to be unnecessary, so should be removed to rule out any conflicts. If the old WP site was working OK (using mod_rewrite) then it is a mystery why directives like the first block you posted seemingly do nothing - that doesn't make sense, unless you are seeing a cached response?! Certainly make sure the browser cache is disabled/cleared before further testing. – MrWhite Jul 26 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.