0
Welcome Guest! Login
0 items Join Now

Any .htaccess rewrite 301 experts

  • Any .htaccess rewrite 301 experts

    Posted 11 years 9 months ago
    • Hi

      I have had one of my joomla websites, we will call it oldsite.com running smoothly for the last year, but I have just been informed that my hosts will be discontinuing their virtual server services and so I need to move my website to a new home.

      As soon as I found this out, I set up a virtual cloud server with a new host, but wanted to make sure they would be able to support Joomla properly and so I could test the site as working before I transfered the domain, so I also registered a new domain name, which we will call newsite.com

      Everything has gone well so far, I have the old joomla site working well in the new server and the new domain name, and I actually prefer the new domain name, so I have decided I want to use this as the new canonical name for the site.

      So on the new server, I could do with setting up a .htaccess file for the oldsite.com hosting area which will perform a 301 redirect to whatever page is accessed, but instead of ... I would like to redirect them to ... with a 301 redirect... this I can almost get my head around, and my initial tests seem to work... But I have made it a little more complicated...

      In migrating my website, I wanted to cure an issue which was a relic from my learning joomla long ago, which is the old joomla site was based in a subdirectory, so in other words, the old website home page was at.

      and at the new website, all pages will have the same path, except without /CMS/ such as

      ..

      Basicly, I would like whatever old URL in page requests to be redirected from

      ..

      to

      .. (and then whatever additional path and page address was in the above request)

      Does this make sense?

      I have managed to get my head around most of the mod_rewrite features and syntax, but I am having problems understanding the exact code that would work best for my application and complications... anyone here able to help me?

      I would continue studying mod_rewrite, but to be honest, unless I have to move servers again, I doubt I will need what I learn again in the future, so it may be a waste of my time.. especially when one of you guys might be a .htacess and mod_rewrite guru :)

      Anyway, I would really appreciate any help.. Please!
    • Last Edit: 9 years 3 months ago by Kat05.
    • Dipping my toe in and out of web design.. Jack of all, Master of none!
    • Who?'s Avatar
    • Who?
    • Preeminent Rocketeer
    • Posts: 25562
    • Thanks: 613
    • Joomla freelancer

    Re: Any .htaccess rewrite 301 experts

    Posted 11 years 9 months ago
    • It is always a pleasure to help people who admit from the beginning that they don't want to waste their time on something :shock: Especially on something so simple that it actually takes minute or two to figure out 8)
      Redirect 301 REMOVED
    • Last Edit: 9 years 3 months ago by Kat05.
    • Check my services at: Mihha-Vision
  • Re: Any .htaccess rewrite 301 experts

    Posted 11 years 9 months ago
    • Igor, I think you got the wrong end of the stick.

      I have already spent about 40 hours on learning, or trying to learn in the intricacies of mod_rewrite in .htaccess, which has already turned into a can of worms.

      I say it is a can of worms because firstly you read the Apache manual pages on mod_rewrite, which automatically assume you are already a proficient apache admin with scripting experience... So every few lines of the manual pages you find yourself having to cross reference search what it is talking about or trying to fill in the blanks.

      You need to remember that most people in the joomla world, use joomla to save themselves having to learn, and become experts on php programming and using SLQ within php, along with CSS and having to bother building their own CMS engine.

      Probably because they are "creative" people rather than "technical" people.

      So when someone says they can not bother in all the study to become an expert in an obscure module in Apache, which they will only ever need when they move web servers, please don't take it that they want your advice because they can't be bothered, maybe I did not elaborate enough on how much effort I have already put into learning this.

      I did initially try to achieve what I wanted to achieve for two domain names...

      on one name to migrate my already existing website to a new host to test it, which was traumatic, but I pushed through it and managed to get the whole site working in a new domain on a new virtual host.

      with the other domain (which is in its own virtual host account) I managed relatively quickly to hack together the following .htaccess addition to get the second domain to re-direct all requests for any pages within that domain to the first new domain name with only the actual domain name changing with a redirect status (?) of 301 to make sure google always knows the first domain is the canonical domain... Here is my additional lines for .htaccess..

      This took a bit of time to figure out, which I must admit, really screwed with my head... But I maybe only spend 10 hours learning what I needed for this.

      Which is a lot more in depth than the one line redirect command you posted already, is there something I am missing?

      However meanwhile, the OLD website, with its two original domain names, is still on the old server.

      Because when I originally set up that server, I already had a html dreamweaver created website there, I did not want to build the joomla site in the home directory, of fear as I was learning to bringing my whole website crashing to the floor, so thought it would be safer to keep in in a subdirectory in that host, with a name of CMS, so all my page addresses are like this...


      Whereas, when I transfered the site to its new host and domain name, I omitted the /CMS/ subdirectory.

      So the next 30 hours or more, I spent trying to learn more about mod_rewrite to make it so that instead of just throwing every URL request for as would happen if I used my previously learnt script/.htaccess addition, which would just throw up a million page not found errors because obviously every page request would have /CMS/ in the URL which does not exist in the new server.

      But this additional time had me just getting more confused and lost within the apache manuals and everything I could find on the subject, as there is not enough of description in plain english about how the syntax of mod_rewrite works and how to manipulate it further than just a simple redirect in any examples I can find which come with a explanation.

      Leaving me with the last resorts of...

      A: Reading the entire apache manual and stumbling across the small nuggets of info I need to complete my immediate needs... if indeed I do not then need to read the entire documentation on linux because the apache manual may rely on some standards of syntax from, for example the Unix way of scripting or parsing code. (I don't know, because I don't have the next year to do this)

      or

      B: Hoping I could get some help in the Joomla forum at Rockettheme which I subscribe to and have continued to subscribe to for 3 years without asking any stupid questions and instead fought through the learning curve.

      I picked B, because the learning curve I have ahead is damn steep to make the last changes to my .htaccess which I may never need to know again.

      Please do not take any of this personally, but the same logic of not helping someone because it seems they can't be bothered to help themselves, could be extended to ANY question asked in this forum.

      As you might have figured out from my website domain names and the sites there, I am a mechanic, a Porsche specialist... And no that does not make me a millionare. My background in computers is being a programmer for video games in the 1980's and also a motion control programmer in the early 90's before I bowed to pressure and joined what was my fathers business.. So I am not a web developer, I can't afford a web developer and always feel it is better to learn new web skills to maintain my own site to release the vision I have for how my site looks and works... Which I am happy with what I have achieved..

      However, as I am not a web developer, I do not need to know this information, I have tried to learn it as far as I can, and I think I did very well so far..

      As a Porsche mechanic, I am also a technical advisor for the Porsche club, which I help people out who want to fix their car, but without having to learn how to be a mechanic to overcome a hurdle... I am always happy to help people, and it is even better if they have tried to help themselves, but I never chastise someone for not reading the manuals... If someone in the forums I help in asks "how do I know if my ECU is faulty because my car does not start" I do not say "learn component level electronics and buy a scope" and likewise, if someone apologetically mention that they are a builder and have no need to learn "electronics" or how to be a mechanic to get their car on the road, but just need a little help.

      Please, as I said before, don't take this as a direct assult on you, but since I was involved in bulletin boards in the mid 80's, people who didnt answer someones cry for help, but just came back with a complaint of how they asked for the help used to be known as Trolls or Turds, and I know that you have helped millions of people in here over the 3 years I have been a member, but please don't ruin your own reputation by being like this, I guess you might just be having a bad day, hopefully today you are having a better one.

      When asking a complicated question, a little like my original one above, sometimes it is best to keep it short and sweet, otherwise it can become a bit muddled and rambling like this reply I am writing now.. So I tried to keep it short and sweet.. which is why I did not go into as much detail, but I also did not expect to upset someone so much for being honest that if I thought I would need this info again, or if I thought that the learning curve would have an end in sight to solve what may be 3 lines of code, where my main problem is structure and syntax or may not even be possible at all, I would not have ever posted the question.

      So... if anyone is still reading, do you have any idea how and if this can be done.

      Cheers

      Jon
    • Last Edit: 9 years 3 months ago by Kat05.
    • Dipping my toe in and out of web design.. Jack of all, Master of none!
    • Who?'s Avatar
    • Who?
    • Preeminent Rocketeer
    • Posts: 25562
    • Thanks: 613
    • Joomla freelancer

    Re: Any .htaccess rewrite 301 experts

    Posted 11 years 9 months ago
    • Well, I have to admit that I didn't have time to read everything you wrote here (because we have to serve more than 170000 members) but I noticed your last question so I guess that my previous answer didn't satisfy you.

      Since this is more Joomla core "issue" than anything related to RT template and extensions, I would suggest you to ask the same question in official Joomla forum at forum.joomla.org and to try some .htaccess generators that can be found all over the Internet
    • Check my services at: Mihha-Vision
    • Henning's Avatar
    • Henning
    • Preeminent Rocketeer
    • Posts: 29362
    • Thanks: 954
    • Volunteer

    Re: Any .htaccess rewrite 301 experts

    Posted 11 years 9 months ago
    • Henning's Avatar
    • Henning
    • Preeminent Rocketeer
    • Posts: 29362
    • Thanks: 954
    • Volunteer

    Re: Any .htaccess rewrite 301 experts

    Posted 11 years 9 months ago
  • Re: Any .htaccess rewrite 301 experts

    Posted 11 years 9 months ago
    • Hi Henning,

      Thats much more useful, a link to a site which clearly steps through mod_rewrite in plain English without the assumption that you are already an Apache expert.

      Thanks, hopefully I can resolve this with this useful site :D

      Igor, I don't think this is a joomla issue, perhaps a Apache issue, but that is a pretty closed community of Apache admins who are not too intermediate user friendly.. Which is why I put this in the watercooler area, as a off core topic discussion you might have with workmates while searching for the solution of a problem while stood at the "watercooler"... Nevermind.
    • Dipping my toe in and out of web design.. Jack of all, Master of none!
  • Re: Any .htaccess rewrite 301 experts

    Posted 11 years 9 months ago
    • Thanks to Hennings useful link, I think I have a solution to the problem, which for the sake of the archives and other people looking for the same help, I shall post the solution here once it is tested.

      I think the solution will include dividing the problem down.. Having the destination server and domain host with a htaccess file which will modify the url to loose the /CMS/ element, and the original domain names having hosting which will just be a .htaccess file which will redirect all URL requests to the destination server while preserving the non domain part of the URL request.

      Keeps things much more simple and easy to maintain in the future.
    • Dipping my toe in and out of web design.. Jack of all, Master of none!

Time to create page: 0.041 seconds