Welcome to the Geeks & God Static Archive. Read more »

Site Wide Redirect

Joined: 11/28/2008

Is there a way to setup a site wide redirect so that if you go to any of our sites old pages, you will automatically be sent to our new site?

Joined: 11/28/2008
Are you using Apache as the

Are you using Apache as the web server? If so, you could do a couple of different things in a .htaccess file. Can you post the new and old locations? Or equivalents are enough.

Paul Davey
Whitford Church
"Everyone who calls on the name of the Lord will be saved." Romans 10:13
"For all have sinned and fall short of the glory of God, and are justified

Joined: 11/28/2008
bobbymac @ Sep 3 2005,
QUOTE(bobbymac @ Sep 3 2005, 11:18 AM)
Are you using Apache as the web server?  If so, you could do a couple of different things in a .htaccess file.  Can you post the new and old locations?  Or equivalents are enough.

Yep, Apache is used here are two equivalent pages:

Old Version

New Version

Joined: 11/28/2008
Does the redirect for each

Does the redirect for each page need to go to the corresponding page, or just the new site? I'm hoping the latter /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />

CODE
#http://extremechristianministries.com/eternal_decision_interview.htm
#http://extremechristianministries.com/ECM/index.php?option=com_content&task=view&id=31&Itemid=31
RewriteEngine On
RewriteCond %{REQUEST_URI}    !^/ECM
RewriteRule ^.*$ /ECM/index.php [R=301,L]

You can try that, though it depends on what other files you have (and where) on your site. It will affect any images or other files not located under the ECM directory.

Paul Davey
Whitford Church
"Everyone who calls on the name of the Lord will be saved." Romans 10:13
"For all have sinned and fall short of the glory of God, and are justified

Joined: 11/28/2008
Where do I add that?

Where do I add that?

Joined: 11/28/2008
Create a file called

Create a file called .htaccess and upload it to your public_html directory. If there's already one there, you ought to open it, and put the new code underneath and upload it again.

~Andrew~

Joined: 11/28/2008
Ok, I added it and it worked,

Ok, I added it and it worked, but, I have a couple of pages that I still need to have access to outside of the site. Is there a way to tweak the code to allow those to still be pulled up?

Joined: 11/28/2008
An alternative way is to use

An alternative way is to use a permanent redirect in your .htaccess file, e.g.

CODE
Redirect permanent /eternal_decision_interview.htm http://extremechristianministries.com/ECM/index.php?option=com_content&task=view&id=31&Itemid=31

You'd have to do it for each page (it doesn't matter whether the old page still exists or not).

Or, if you have removed the old pages, you can use a script like http://xav.com/scripts/guardian/ to redirect based on the 404 Error system (without displaying any error messages, but simply redirecting the visitor to the appropriate file).

Begin to weave and God will give you the thread
- German Proverb

Joined: 11/28/2008
kerux @ Sep 5 2005,
QUOTE(kerux @ Sep 5 2005, 07:22 AM)
Ok, I added it and it worked, but, I have a couple of pages that I still need to have access to outside of the site. Is there a way to tweak the code to allow those to still be pulled up?

Yes - they would need to be added as exceptions (extra RewriteCond rules) - one for each page/directory. Can you list them out?

Paul Davey
Whitford Church
"Everyone who calls on the name of the Lord will be saved." Romans 10:13
"For all have sinned and fall short of the glory of God, and are justified

Joined: 11/28/2008
I got it worked out, I just

I got it worked out, I just went in and added each redirect one at a time. Thanks for the help.