Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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

2 Answers 2

up vote 4 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/"
</script>
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

 
discard

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.