flemingmike Posted March 15, 2009 Share Posted March 15, 2009 is it possible to make http://www.mysite.com/index.php really goto http://www.mysite.com/directory/index.php Link to comment https://forums.phpfreaks.com/topic/149561-indexphp-to-redirect-silently/ Share on other sites More sharing options...
pcw Posted March 15, 2009 Share Posted March 15, 2009 Yes, either redirect your domain to go to http://www.mysite.com/directory/index.php or, add this to http://www.mysite.com/index.php print "<META http-equiv='refresh' content='1;URL=http://www.mysite.com/index.php'>"; Link to comment https://forums.phpfreaks.com/topic/149561-indexphp-to-redirect-silently/#findComment-785396 Share on other sites More sharing options...
jackpf Posted March 15, 2009 Share Posted March 15, 2009 Lol, just to add onto that, you could also use php by sending a header, such as: header("location: directory/index.php"); or you could do it in your .htaccess with something like so: RewriteRule ^index.php$ /directory/index.php [R] Link to comment https://forums.phpfreaks.com/topic/149561-indexphp-to-redirect-silently/#findComment-785398 Share on other sites More sharing options...
daviddth Posted March 16, 2009 Share Posted March 16, 2009 Yes, either redirect your domain to go to http://www.mysite.com/directory/index.php or, add this to http://www.mysite.com/index.php print "<META http-equiv='refresh' content='1;URL=http://www.mysite.com/index.php'>"; I have been told that some search engines penalise you for the meta tag way. Based on one of my experiences, the site I had was removed from Google soon after the redirection in that manner. Did not take it long to be reindexed on the new domain, but stilll... A google ex-employee (Brother in law) told me they recommend something along the lines of this: <?php header( "HTTP/1.1 301 Moved Permanently" ); header( "Status: 301 Moved Permanently" ); header( "Location: despertn.html" ); exit(0); ?> Where the Location points to the file, or whole url - your choice. This wont get you penalised on search engines and works great on .php files (or .htm/html if you tell them to be parsed through the php engine). I am currently working on a massive site upgrade and have set a bunch of these files up to point to the newly named files and in testing it's a seamless renaming to the new page - no delay at all. Apparently it's similar to the htaccess way. Link to comment https://forums.phpfreaks.com/topic/149561-indexphp-to-redirect-silently/#findComment-785813 Share on other sites More sharing options...
revraz Posted March 16, 2009 Share Posted March 16, 2009 htaccess is your best bet here. Link to comment https://forums.phpfreaks.com/topic/149561-indexphp-to-redirect-silently/#findComment-785822 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.