Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This may be a silly question, but if I only have access to edit a website through a CMS, and can't touch the headers, is there a way to redirect the page without prompting the user to click a link?

share|improve this question
up vote 5 down vote accepted

You can use JavaScript to redirect them with code in the <body> of the page. It won't be a 301 redirect, however, as you can only do that with HTTP headers.

<script type="text/javascript">
window.location = "http://www.example.com/"
share|improve this answer
perfect. I figured it would have to be js. Thanks! – RCNeil Dec 8 '11 at 18:06

Depends what is the objective.

If it is a permanent, it is better creating a .htaccess file with

Redirect /what http://some.tld/where

share|improve this answer
They said they only have access to the website through a CMS. That would imply they cannot upload or create a .htaccess file. – John Conde Dec 8 '11 at 20:17
Indeed. I don't have FTP access to anything so modifying a .htaccess file is out of the question. The JS redirect works good. Thank you for your answer, though. – RCNeil Dec 9 '11 at 13:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.