• Resolved funkman733

    (@funkman733)


    Hi, I have some problems with wordpress multisite htaccess code to redirections some old domain and old url.

    This htaccess tester http://htaccess.madewithlove.be/ return me some error:

    <IfModule mod_rewrite.c>
    2 	  	RewriteEngine On
    3 	  	RewriteBase /
    4 	  	RewriteRule ^index\.php$ - [L]
    5 	  	# uploaded files
    6 	  	RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    7 	  	# add a trailing slash to /wp-admin
    8 	  	RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    9
    10 	  	RewriteCond %{REQUEST_FILENAME} -f [OR] 	This variable is not supported: %{REQUEST_FILENAME}
    11 	  	RewriteCond %{REQUEST_FILENAME} -d 	This variable is not supported: %{REQUEST_FILENAME}
    12 	  	RewriteRule ^ - [L] 	This rule was not met because one of the conditions was not met
    13 	  	RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    14 	  	RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    15 	  	RewriteRule . index.php [L] 	This rule was met, the new url is http://inonda.tv/index.php
    The tests are stopped because the L in your RewriteRule options
    16 	  	</IfModule>
    17
    18 	  	<IfModule mod_security.c>
    19 	  	SecFilterEngine on
    20 	  	SecFilterScanPOST on
    21 	  	</IfModule>
    22
    23 	  	RewriteCond %{HTTP_HOST} ^otranto\.inonda\.le\.it$ [OR]
    24 	  	RewriteCond %{HTTP_HOST} ^www\.otranto\.inonda\.le\.it$
    25 	  	RewriteRule ^/?$ "http\:\/\/vacanze\.inonda\.tv\/" [R=301,L]
    26
    27 	  	RewriteCond %{HTTP_HOST} ^inonda\.le\.it$ [OR]
    28 	  	RewriteCond %{HTTP_HOST} ^www\.inonda\.le\.it$
    29 	  	RewriteRule ^/?$ "http\:\/\/inonda\.tv" [R=301,L]
    30
    31 	  	RewriteCond %{HTTP_HOST} ^inonda\.eu$ [OR]
    32 	  	RewriteCond %{HTTP_HOST} ^www\.inonda\.eu$
    33 	  	RewriteRule ^/?$ "http\:\/\/inonda\.tv" [R=301,L]

    And when I digit an redirected url it send me in this link: http://inonda.tv/wp-signup.php?new=inonda.le.it (in this case I have digit inonda.le.it) and I have this message:

    Il sito che stavi cercando, http://inondaleit.inonda.tv/, non esiste.

    But if I put on top of my htaccess the RewriteCond and the RewriteRule all old main domain have a correct redirection, but if I click an old post url, it redirect me to the wp-signup page.. to redirect all permalink I have used permalink finder plugin and all worked fine before 4.0 version. Now, if I deactivate permalink finder, all old link is redirect to wp-signup page….. and the error is in the htaccess wordpress multisite code. But what is the error? What should I do?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Rule one: ALWAYS put WP rules at the bottom.

    What are you trying to redirect from and to?

    Thread Starter funkman733

    (@funkman733)

    Well, now I have tried this htaccess code:

    <IfModule mod_security.c>
    SecFilterEngine on
    SecFilterScanPOST on
    </IfModule>
    
    RewriteEngine On
    
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    RewriteCond %{HTTP_HOST} ^otranto\.inonda\.le\.it$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.otranto\.inonda\.le\.it$
    RewriteRule ^/?$ "http\:\/\/vacanze\.inonda\.tv\/" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^inonda\.le\.it$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.inonda\.le\.it$
    RewriteRule ^/?$ "http\:\/\/inonda\.tv" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^inonda\.eu$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.inonda\.eu$
    RewriteRule ^/?$ "http\:\/\/inonda\.tv" [R=301,L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
    RewriteRule ^(.*\.php)$ wp/$1 [L]
    RewriteRule . index.php [L]

    and now
    inonda.le.it -> inonda.tv
    inonda.eu -> inonda.tv
    otranto.inonda.le.it -> vacanze.inonda.tv

    but if I would to redirect an old domain post share in social network or linked in a forum, with or not Permalink Finder plugin it do this:
    http://inonda.le.it/citta-otranto-erede-bisanzio/ -> http://inonda.tv/wp-signup.php?new=inonda.le.it

    but it should to do this:
    http://inonda.le.it/citta-otranto-erede-bisanzio/ -> http://inonda.tv/2014-05-23-citta-otranto-erede-bisanzio/

    before 4.0 it work fine…..

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Dunno why that ever worked but…

    RewriteCond %{HTTP_HOST} ^inonda\.le\.it [NC]
    RewriteRule ^(.*) http://inonda.tv/$1 [R=301,L]

    I do it that way (detailed out here http://halfelf.org/2012/htaccess-anarchy/ ) and it’s worked fine. Still does.

    Thread Starter funkman733

    (@funkman733)

    Interesting article!!!!
    So, if I add a right redirect rule from old link to new link (one rule for all link) it can work fine and I can deactivate Permalink finder plugin???

    Thread Starter funkman733

    (@funkman733)

    Thanks Thanks Thanks your code work very fine!!!!!
    But if I want to deactivate the permalink finder plugin, what code I should to write to have perfect posts redirection?

    Sorry for this last question!

    Thread Starter funkman733

    (@funkman733)

    is it right this code?

    RewriteCond %{HTTP_HOST} ^inonda\.le\.it [NC]
    RewriteRule ^(.*) http://inonda.tv/([0-9]{4})-([0-9]{2})-([0-9]{2})-(.*)$1 [R=301,L]
    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    But if I want to deactivate the permalink finder plugin, what code I should to write to have perfect posts redirection?

    Mmmm. It’s hard.

    http://inonda.le.it/citta-otranto-erede-bisanzio/ -> http://inonda.tv/2014-05-23-citta-otranto-erede-bisanzio/

    See there’s NO way to magically know what the YMD stuff is. If you’re coming from http://inonda.le.it/citta-otranto-erede-bisanzio/ then it can only go to http://inonda.tv/citta-otranto-erede-bisanzio/ because the htaccess rule can’t make up the YMD stuff. And with the basic rule I gave you, you’ll go from

    http://inonda.le.it/2014-05-23-citta-otranto-erede-bisanzio/ to http://inonda.tv/2014-05-23-citta-otranto-erede-bisanzio/

    Thread Starter funkman733

    (@funkman733)

    mmm… ok. I should to do the redirection for all sigle url site posts …..

    sorry for my english

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    I don’t think you can do what you want.

    RewriteCond %{HTTP_HOST} ^inonda\.le\.it [NC]
    RewriteRule ^(.*) http://inonda.tv/$1 [R=301,L]

    There’s no way to detect the 2014-05-23 unless it’s in the original URL.

    Thread Starter funkman733

    (@funkman733)

    Ok, but with Permalink Finder plugin it do what I need, and redirect old urls to all new dated urls.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Then by all means use it.

    https://ww.wp.xz.cn/plugins/permalink-finder/

    That’s the plugin for anyone else who wants to use it (funkman733, please ALWAYS link to the plugins 🙂 there are 35k of them and it saves everyone time if you do that).

    Thread Starter funkman733

    (@funkman733)

    Ok sorry for missed plugin link!!!!

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Problems with 301 redirect functions and wordpress multisite htaccess code’ is closed to new replies.