Jump to content

Cant redirect main page or the .index.htm HELP


huntersj78

Recommended Posts

Sorry for asking stupid questions all the time guys (and gals).  Ok there are two sites.  www.dmj.fm  and www.discoverymusic.jp

 

The latter will eventually be phased out, but I am still using it as a base because of my databases that are still in use. 

I want to make only the home page (www.discoverymusic.jp) redirect to www.dmj.fm( www.dmj.fm redirects to http://junco-cheep.seesaa.net/)  I put the same code as I did in dmj.fm and it works, but www.discoverymusic.jp doesnt.

 

Here is the code I used in the index page. 

<?php
header('location:http://junco-cheep.seesaa.net/');
?>

 

When you type www.discoverymusic.jp into the address bar it is just blank, but if you add index.html to the end it redirects just fine.

 

What am I doing wrong?? :'(

Link to comment
Share on other sites

.htm? Add a .htaccess entry to force the index.htm file as the default opened page.

DirectoryIndex index.htm

 

Also, Most browsers will fail to read the header if it's not capitalized and in RFC format.

header('Location: http://junco-cheep.seesaa.net/');

 

Once you place the .htaccess in root of www.discoverymusic.jp it should work fine.

Link to comment
Share on other sites

WOW that is a fast response.  Here is the original htaacces.

 

AddType application/x-httpd-php .inc .html

 

Is that not right?  Sorry I am just a beginner.  The htm in the title was a typo..  I have the index.html in the root along with the above htaacces.

 

Then try this as your .htaccess:

DirectoryIndex index.html
AddType application/x-httpd-php .inc .html

 

The addtype simply allows parsing of PHP code in a .html document.. in case you did not know.

 

Link to comment
Share on other sites

WOW that is a fast response.  Here is the original htaacces.

 

AddType application/x-httpd-php .inc .html

 

Is that not right?  Sorry I am just a beginner.  The htm in the title was a typo..  I have the index.html in the root along with the above htaacces.

 

 

 

Then try this as your .htaccess:

DirectoryIndex index.html
AddType application/x-httpd-php .inc .html

 

The addtype simply allows parsing of PHP code in a .html document.. in case you did not know.

 

Doesnt redirect just stays blank.  If I manually type index.html after the url it redirects though.  And thanks for the addtype tip.

Link to comment
Share on other sites

That's telling the server to forcefully open index.html. I haven't a clue why you need to enter it after typing that.

 

Try removing index.html and .htaccess and just create a new index.php with the redirection code, There's nothing you're doing that should warrant having to physically enter it, I'm not sure how your server is set up.

Link to comment
Share on other sites

if ur using the xampp then do this

under the apache folder there will be conf folder which has httpd.conf,

open it with any text editor and

check for the line 249

<

IfModule dir_module>

    DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \

                  default.php default.pl default.cgi default.asp default.shtml default.html default.htm \

                  home.php home.pl home.cgi home.asp home.shtml home.html home.htm

</IfModule>

 

and see for this <IfModule change it like which i have shown above this should resolve the issue

Link to comment
Share on other sites

if ur using the xampp then do this

under the apache folder there will be conf folder which has httpd.conf,

open it with any text editor and

check for the line 249

<

IfModule dir_module>

    DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \

                  default.php default.pl default.cgi default.asp default.shtml default.html default.htm \

                  home.php home.pl home.cgi home.asp home.shtml home.html home.htm

</IfModule>

 

and see for this <IfModule change it like which i have shown above this should resolve the issue

 

Thanks for your help but all I know is that I am renting a server.  I have access to it but I dont know where to look for the above.  I ususally do everything through FTP.

Link to comment
Share on other sites

I forgot. You can leave out the html page all together and just use this. Clear out your .htaccess file or append this line, but it'll be a more compatible method of redirection:

Simple:

redirect 301 / http://junco-cheep.seesaa.net/

Or..

Using mod_rewrite (try this instead of simple method.):

RewriteCond %{HTTP_HOST} ^(www\.)?discoverymusic\.jp [NC]
RewriteRule ^(.*)$ http://junco-cheep.seesaa.net/$1 [R=301,L]

 

Do those work?

Link to comment
Share on other sites

I forgot. You can leave out the html page all together and just use this. Clear out your .htaccess file or append this line, but it'll be a more compatible method of redirection:

Simple:

redirect 301 / http://junco-cheep.seesaa.net/

Or..

Using mod_rewrite (try this in place of simple method.):

RewriteCond %{HTTP_HOST} ^(www\.)?discoverymusic\.jp [NC]
RewriteRule ^(.*)$ http://junco-cheep.seesaa.net/$1 [R=301,L]

 

Does this work?

 

I will try it now.  I will stick to the simple because I have no idea how to use mod_rewrite yet..  I will let you know.

Link to comment
Share on other sites

I did the full mod_rewrite for you there, if the first method doesn't work (second redirects any part of the domain to work better)  so you have no need to write it yourself, but yeah, It should work.

 

What they do, is it tells the server to send a 301 (redirection) code to the client telling them to go to the secondary domain. This is more serverside rather than just telling the client to go somewhere else, so it can't be a blank page like you saw before.

Link to comment
Share on other sites

I did the full mod_rewrite for you there, if the first method doesn't work (second redirects any part of the domain to work better)  so you have no need to write it yourself, but yeah, It should work.

 

What they do, is it tells the server to send a 301 (redirection) code to the client telling them to go to the secondary domain. This is more serverside rather than just telling the client to go somewhere else, so it can't be a blank page like you saw before.

 

Can you check out my server and see if I have the right module for a mod_rewrite?  http://www.discoverymusic.jp/phpinfo.php

 

Also do I do the rewrite on the htaccess file?

Link to comment
Share on other sites

I forgot. You can leave out the html page all together and just use this. Clear out your .htaccess file or append this line, but it'll be a more compatible method of redirection:

Simple:

redirect 301 / http://junco-cheep.seesaa.net/

Or..

Using mod_rewrite (try this in place of simple method.):

RewriteCond %{HTTP_HOST} ^(www\.)?discoverymusic\.jp [NC]
RewriteRule ^(.*)$ http://junco-cheep.seesaa.net/$1 [R=301,L]

 

Does this work?

 

I will try it now.  I will stick to the simple because I have no idea how to use mod_rewrite yet..  I will let you know.

 

Ok so I tried the 301, but it redirected everything...ouch.  I only want it to redirect the main url.  I still use some of the sub folders until I can figure out how to change over my databases.

 

I guess I am stuck with the blank page until I can get around this.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.