How to best redirect from a subfolder to a phpwcms page?

Post non-phpwcms related topics here - but I don't want to see "hey check this or that other cms". Post if you have a point or worthwhile comment, don't post just to increase you post count!
Post Reply
spirelli
Posts: 996
Joined: Tue 27. Jul 2004, 13:37
Location: London

How to best redirect from a subfolder to a phpwcms page?

Post by spirelli »

OK, here is a question.

At the moment I am redirecting visitors from http://www.domain.net/subfolder to a phpwcms page using

Code: Select all

<meta http-equiv="refresh" content="0; URL=http://www.domain.net/phpwcmspage.phtml">
I also have a message on these redirecting pages saying
"redirecting... click here if nothing happens"
However I have heard that:
Actually some browsers allow you to surpress meta redirects and according to the web accessibility guidelines you shouldn't redirect with this technique.
You can also redirect on the server directly or via an SSI, for example PHP:

Code: Select all

<?PHP header('Location:otherfile.html'); ?>
My concern is that I really would like to get rid of the message on the redirecting pages in order for the visitor not to notice so much that he/she is redirected. So I wonder which technique to use in order to make 100% sure that visitors end up on the page they are supposed to end up. Please let me know your opinion.
Thanks.
spirelli
Posts: 996
Joined: Tue 27. Jul 2004, 13:37
Location: London

Post by spirelli »

ok, found the solution with including a .htaccess file in the subfolder with the content:

Code: Select all

Redirect /subfolder/ http://www.domain.net/index.php?alias

Much better than META tag! :D
brans

Post by brans »

[R=301]

means that also search engines wont index your old page anymore :-D
(place this flag at the end of the line that was posted above.
spirelli
Posts: 996
Joined: Tue 27. Jul 2004, 13:37
Location: London

Post by spirelli »

thanks for your reply. can you explain a bit more how this works and what it means, please?
brans

Post by brans »

English Post:
----------------------------------------------------------------
Ok man first have a look at this:

http://www.regular-expressions.info/reference.html

and then you will already understand a lot more. I have then a look
at this:
http://www.altaway.com/support/htaccess.html#5

and if you have understood those two tuts have a look at the example showing up a solution for your problem
http://httpd.apache.org/docs-2.0/misc/r ... e.html#url here.

I hope this will help you in using mod_rewrite in the future, it is very powerful!
----------------------------------------------------------------
----------------------------------------------------------------

German Post:
----------------------------------------------------------------
Alle Deutschsprachigen sollten sich einfach mal unter folgender
Url umschauen: http://www.modrewrite.de
Ich persönlich halte diese Seite für die beste im Netz (inklusive aller englischsprachigen, die ich bisher gefunden habe).
----------------------------------------------------------------
spirelli
Posts: 996
Joined: Tue 27. Jul 2004, 13:37
Location: London

Post by spirelli »

ok, understood: [R=301] is the status-code for "Moved Permanently". Thanks.
brans

Post by brans »

yes thats it :D
Post Reply