#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1

    Redirect blocks the site search button


    Hello
    in my .htaccess I have this redirect..

    RewriteRule .? https://www.mysite.it/%{REQUEST_URI}? [R=301,L]

    Unfortunately block button search.. that should give this URL

    https://www.mysite.it/?s=whatsapp&cat=0

    Can you help me?
    Thanks
    Fabrizio
  2. #2
  3. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,815
    Rep Power
    9646
    .htaccess redirects do not change the URLs the site tells the browser to use. Like it will not change links or forms. You have to do that yourself.

    But that redirect does not look right. What's the full contents of your .htaccess?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1
    I can send you in email... I did a migration and there are many redirects. But this that I have indicated to you is the one that blocks me the search and the operation of widgets in personalize Wordpress (I don't see widget)
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1
    If I remove this RewriteRule .? https://www.mysite.it/%{REQUEST_URI}? [R=301,L] work all.. but how should be corrected
  8. #5
  9. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,815
    Rep Power
    9646
    Your description is vague but it sounds like your site is still trying to link to the old URLs? Are they on a different site? I'm not sure what this rewriting is supposed to do, or what problem it's supposed to fix.

    What's the rest of the rewriting rules? All the RewriteConds and RewriteRules. Please just post it here - you can change domain names and other sensitive information if you want.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1
    Yes you are right... this is my .htaccess with RewriteCod and RewriteRules

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteRule ^\d{4}/\d\d/(default) /$1 [R=301,L]
    RewriteCond %{QUERY_STRING} .
    RewriteCond %{QUERY_STRING} !^item=
    RewriteCond %{REQUEST_URI} !^/manage
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$

    # RewriteRule .? https://www.mysite.it/%{REQUEST_URI}? [R=301,L]

    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule ^(.*).aspx$ https://www.mysite.it/$1 [R=301,L]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule ^.*post/\d{4}/\d{2}/\d{2}/(.*) /$1/ [R=301,L]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule post/\d{4}/\d{2}/\d{2}/(.*) /$1/ [R=301,L]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule \d{4}/\d{2}/\d{2}/(.*) /$1/ [R=301,L]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule BlogEngine/post/\d{4}/\d{2}/\d{2}/(.*) /$1/ [R=301,L]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule blogengine/post/\d{4}/\d{2}/\d{2}/(.*) /$1/ [R=301,L]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule BlogEngine/post/(.*) /$1/ [R=301,L]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule blogengine/post/(.*) /$1/ [R=301,L]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule ^post/(.*) /$1/ [R=301,L]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule . /index.php [L]
    </IfModule>
  12. #7
  13. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,815
    Rep Power
    9646
    Let's clean that up a bit.
    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^[0-9]+\..+\.cpaneldcv$ - [L]
    RewriteRule ^\.well-known/acme-challenge/[0-9a-zA-Z_-]+$ - [L]
    RewriteRule ^\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ - [L]
    
    RewriteRule ^\d{4}/\d\d/(default) /$1 [R=301,L]
    
    # RewriteCond %{QUERY_STRING} .
    # RewriteCond %{QUERY_STRING} !^item= 
    # RewriteCond %{REQUEST_URI} !^/manage
    # RewriteRule .? https://www.mysite.it/%{REQUEST_URI}? [R=301,L] 
    
    RewriteRule ^(.*).aspx$ https://www.mysite.it/$1 [R=301,L]
    RewriteRule ^.*post/\d{4}/\d{2}/\d{2}/(.*) /$1/ [R=301,L]
    RewriteRule ^\d{4}/\d{2}/\d{2}/(.*) /$1/ [R=301,L]
    RewriteRule ^[Bb]log[Ee]ngine/post/(.*) /$1/ [R=301,L]
    RewriteRule ^post/(.*) /$1/ [R=301,L] 
    RewriteRule ^index\.php$ - [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    I moved the .cpaneldcv and .well-known conditions into rules at the beginning. A couple of the other rules were also redundant.

    And if you comment out a Rule then you need to comment out the Conds before it, otherwise they'll apply to the next uncommented Rule (about .aspx requests).

    So, the part you're working with:
    Code:
    # RewriteCond %{QUERY_STRING} .
    # RewriteCond %{QUERY_STRING} !^item=
    # RewriteCond %{REQUEST_URI} !^/manage
    # RewriteRule .? https://www.mysite.it/%{REQUEST_URI}? [R=301,L]
    What are you using it for? It won't accomplish anything unless the original request was not HTTPS or it was for a different domain - neither of which are the case here, I don't think.
    Last edited by requinix; February 23rd, 2018 at 08:30 AM.
  14. #8
  15. #9
  16. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1
    Your code work, but I don't know what means that comand... programmer made that code ..
    Thank you very much!
  17. #10
  18. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1
    Can you help me to put in the same htaccess this redirect

    ORIGIN
    https://www.mysite.it/image.axd?pict...sapp-emoji.jpg

    DESTINATION
    https://www.mysite.com/wp-content/up...sapp-emoji.jpg

    I tried this but don't redirect

    RewriteCond %{QUERY_STRING} picture=([^&]+) [NC]
    RewriteRule ^image\.axd$ /wp-content/uploads/upload/%1? [L,NC,NE,R=301]

IMN logo majestic logo threadwatch logo seochat tools logo