WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] 301 redirection in .htaccess file not working (1 post)

  1. cableghost
    Member
    Posted 1 year ago #

    I'm attempting to redirect an internal link via .htaccess file and it's not working. Below is my .htaccess file.

    How might I better structure the code to allow working redirection links?

    # Use PHP 5.3
    AddType application/x-httpd-php53 .php 
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # Redirects
    Redirect 301 /oldpage http://domain/newpage
    
    # Start Hotlink Protection
    
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domain.com [NC]
    RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]
    
    ## EXPIRES CACHING ##
    
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType text/css "access 1 month"
    ExpiresByType text/js "access 1 month"
    ExpiresByType application/pdf "access 1 month"
    ExpiresByType text/x-javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access 2 days"
    </IfModule>

Topic Closed

This topic has been closed to new replies.

About this Topic