ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Temporary redirects while developing — htaccess?

March 04, 2011 2:13pm

Subscribe [5]
  • #1 / Mar 04, 2011 2:13pm

    gazaston

    128 posts

    Hi there

    I’m putting phase one of a site live next week. The templates are in place, but many only with dummy content.

    What I want to be able to do is direct all links to unfinished pages to a generic “under development” template. At the moment the only way I can think is to go through the whole site and manually change the links.

    Is there a clever way EE can do this? Could I use a list of URLs in .htaccess? Any examples?

    Thanks in advance for any assistance.

    Gary

  • #2 / Mar 05, 2011 12:44pm

    mz91184

    100 posts

    I think if you put the following in your htaccess it should do the trick.

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www\.domain\.com$
    RewriteRule ^facts/(.*)$ <a href="http://www.domain.com/newfacts/">http://www.domain.com/newfacts/</a> [R=permanent,L]

    If you still need to access these templates for testing, you can adjust each templates access levels.  Give the super admin access only and then redirect all pages to your “under development” template.

    Hope this helps.

  • #3 / Mar 05, 2011 1:22pm

    Kurt Deutscher

    827 posts

    Since 2.0, its been possible to use a user defined global variable (even in the “textarea” custom entry fields of the publish page) for this sort of thing.

    Here’s more information on how we’ve been using them.

    .htaccess might be a slicker way, but not everyone has good success with it.

  • #4 / Mar 06, 2011 3:32pm

    Greg Salt

    3988 posts

    Hi Gary,

    Can you not use EE’s template access controls to redirect all but logged in users to a particular template? .htaccess doesn’t sound like the right solution here and especially not if you use a permanent redirect (301).

    Cheers

    Greg

  • #5 / Mar 06, 2011 3:48pm

    gazaston

    128 posts

    Sorry, i should have made clear - I actually want the portions of the site that have content to go properly live, i.e. available to all visitors. Is htaccess not the way to do this?

    mz91184 - sorry for the noobness but how would I enter multiple URLs into your example?

  • #6 / Mar 06, 2011 5:55pm

    mz91184

    100 posts

    If you want to redirect specific pages, I would suggest using multiple 301 redirects.  Add a redirect for each page you want hidden.

    redirect 301 /old/old.htm http://www.you.com/new.htm

    Hope this helps, I know just enough about htaccess to be dangerous.

  • #7 / Mar 07, 2011 4:13am

    John Henry Donovan

    12339 posts

    Gary,

    This thread is more suitable for the CodeShare Corner especially advice regarding your htaccess. Moving it there for you and hopefully some of our community can offer you some more advice.

    It does sound however that you will need multiple temporary redirects in place inside your htaccess

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases