301 Redirect in Wordpress not working in htaccess

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

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

RewriteEngine on
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) /$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 (.*) /$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, priceg, iedit.ilovevitaly, toddard, intained, icalc.ilovevitaly, ilovevitaly.co, co.lumb.co/, co.lumb.co, semalt.semalt, semalt, buttons-for-website, semalt.semalt, a.xtopoly, hulfingtonpost, forum.topic29421116.darodar, 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' > new-domain/category
  • Most efficient for SEO
  • HTTP + HTTPS from old domain to HTTPS on new domain

What am I missing? Thanks.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745292738a4620957.html

相关推荐

  • 301 Redirect in Wordpress not working in htaccess

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

    5小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信