+ Reply to Thread
Results 1 to 8 of 8

Thread: Managing 301 Redirects correctly in FlyNax htaccess file

Hybrid View

  1. #1
    Junior Member
    Join Date
    Jun 2017
    Posts
    25

    Managing 301 Redirects correctly in FlyNax htaccess file

    Hello:

    I have just converted a long standing live classifieds site to FlyNax version 4.6.1

    I am now trying to manage the hundreds, and even thousands of broken links.

    I would normally do this with .htaccess with a Redirect Permanent statement.
    For example:
    at the very bottom of the .htaccess in the root of flyNax installation.

    I have

    RedirectPermanent /Home/ClassifiedsAds/163/ https://www.concreteiron.com/classifieds.html

    But this statement does not seem to have any affect, and it just goes to a FlyNax generated 404 page.
    OR it will take me a "site cannot be reached" page, which seems to be breaking the whole site.

    How can I manage these redirects correctly?
    What am I doing wrong?
    Is there some different way to do this?
    I have hundreds of them.
    I dont want Google to report them as broken or soft-broken...
    What is the best practice for managing 301 redirects in FlyNax?

    I have seen other shopping cart and e-commerce programs such as Magento that actually put these in the CMS and allow you to define redirects in the database, and this is very nice.

    and it is critical that I save all my existing traffic on the site, to keep my search results high and the traffic coming.

    What is the advice?
    Last edited by Tim Wade; January 2, 2018 at 01:47 PM. Reason: minor edit

  2. #2
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    3,138
    Hello Tim Wade,

    you can use this:
    Code:
    Only registered members can view the code.
    or use the following code for non-existing files or folders that will redirect to index page:
    Code:
    Only registered members can view the code.

  3. #3
    Junior Member
    Join Date
    Jun 2017
    Posts
    25

    Redirect still not working as expected

    when I try your code it fails.
    I put this line at the end of .htaccess in the root folder

    Redirect /Home/ClassifiedsAds/163/ http://www.concreteiron.com/classifieds.html

    and the result is "404" not the redirected page

    the URL shows parameters being auto added to the address
    https://www.concreteiron.com/classif...sifiedsAds/163

    how do I get it to not add these url params and do the redirect exact as needed?
    Last edited by Tim Wade; January 2, 2018 at 01:48 PM. Reason: didnt keep the whole message the first time

  4. #4
    I too have the same issue of parameters being auto added to the address!

  5. #5
    Junior Member
    Join Date
    Jun 2017
    Posts
    25
    and I put these at the end of .htaccess? or where is best?

  6. #6
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    3,138
    Hello,

    Try this:

    Code:
    Only registered members can view the code.
    if it doesn't help create a ticket

  7. #7
    Junior Member
    Join Date
    Jun 2017
    Posts
    25
    This code does not work either... as the other rewrite rules still execute/apply, this adding all the other parameters to the resulting URL
    it still generates this exact URL
    https://www.concreteiron.com/classif...sifiedsAds/163

    so there needs to be a way to stop the other rewrite rules from executing/applying.

    This is turning into a very urgent matter, as the longer we have thousands of broken links, the more it affects our Google results.

    and, btw, I already created a ticket... you told me to look back at this forum post for an answer.

  8. #8
    Junior Member
    Join Date
    Jun 2017
    Posts
    25

    Working Code Added, based on FlyNax Support answer

    okay after discussions with FlyNax Support and clearing my cache on my browser correctly, I have determined that the last suggestion does actually work.
    However, the position is critical. I was trying to put it at the end of .htaccess, but it actually needs to live just above the last few Rewrite rules
    Here is the code I added to .htaccess but is HAS TO BE before the "define other pages" Rewrite block approximately around line 190 in v4.6.1 .htaccess file

    #code has to be before the "define other pages" rewrite rule block and sitemaps block to work correctly
    # /Home/ClassifiedAds/ pattern matching 301 redirects ( jeff 2018-01-06 )

    #test https://www.concreteiron.com/Home/ClassifiedsAds/163/
    #test https://www.concreteiron.com/Home/Cl...ng&Model=P-305
    #test https://www.concreteiron.com/(X(1)S(...ookieSupport=1
    #result https://www.megairon.com/classifieds.html

    RewriteRule ^(.*)Home/ClassifiedsAds/(.*)$ /classifieds.html? [R=301,L] #all old links in the HOME ClassifiedsAds Structure

    # ^ symbol starts a string to match
    # $ symbol ends a string to match
    # (.*) wildcard for any string and/or query string
    # ? symbol at end of classifieds.html tells it to not add any query string params, (greedy operator, eats all)

+ Reply to Thread