Whole website redirecting to home page. Newbie help!
Moderator: General Moderators
Whole website redirecting to home page. Newbie help!
Greetings,
I hope I'm posting this question in the right place. This is probably something really easy, but I am a total newbie when it comes to php. I used to create websites years ago, all in html, I've never done anything with php, and I am totally lost with this problem.
Background: A friend owns a website, and his webmaster left him suddenly and not on good terms. The old webmaster did something to his website so that no matter what you click on, the only page you get is the home page. He asked me to take a look at it, but since it is all in php, I'm practically useless. I checked his control panel where he has the website hosted, and there are no redirects set up there. I talked to someone at the host company, and I was told that it is probably some kind of script set up in php.
The website is arizonaglassrepair .com. I'm hoping someone can take a quick look and tell me to take out or change a line somewhere to fix the problem, I'd really appreciate any help you can provide.
Thanks in advance.
I hope I'm posting this question in the right place. This is probably something really easy, but I am a total newbie when it comes to php. I used to create websites years ago, all in html, I've never done anything with php, and I am totally lost with this problem.
Background: A friend owns a website, and his webmaster left him suddenly and not on good terms. The old webmaster did something to his website so that no matter what you click on, the only page you get is the home page. He asked me to take a look at it, but since it is all in php, I'm practically useless. I checked his control panel where he has the website hosted, and there are no redirects set up there. I talked to someone at the host company, and I was told that it is probably some kind of script set up in php.
The website is arizonaglassrepair .com. I'm hoping someone can take a quick look and tell me to take out or change a line somewhere to fix the problem, I'd really appreciate any help you can provide.
Thanks in advance.
Re: Whole website redirecting to home page. Newbie help!
He has the pages doing a 302 redirect back to the home page. probably somewhere close to the top of the php pages (not sure how site is set up ) look for something like:
-Greg
Code: Select all
header('Location: http://arizonaglassrepair.com/');
exit;Re: Whole website redirecting to home page. Newbie help!
Greg,twinedev wrote:He has the pages doing a 302 redirect back to the home page. probably somewhere close to the top of the php pages (not sure how site is set up ) look for something like:
-GregCode: Select all
header('Location: http://arizonaglassrepair.com/'); exit;
Thanks for the help. I downloaded the entire site, and I just used a program called Search and Replace that will look for any word or phrase inside files. I searched for ('Location: http://arizonaglassrepair.com/') through a total of 5328 files, and found 0 occurrences. Is it possible there should be a space somewhere in the search string?
When you say the redirect is probably somewhere close to the top of the php pages, do you mean inside of a directory directly under the root directory?
Re: Whole website redirecting to home page. Newbie help!
I did a search for just http://arizonaglassrepair.com and came up with 2 files. Tried it with www in the search string (http://www.arizonaglassrepair.com) and came up with 438 occurrences in 33 files. Looking through these files, I found 3 that had pretty much what you said with an extra space between the ( and the ', so it looked like this: ( 'Location: http://www.arizonaglassrepair.com/' ). The files that this occurs in are all index.php files, in the following locations:
arizonaglassrepair/arizonaglassrepair.com/images/index.php
arizonaglassrepair/arizonaglassrepair.com/include/index.php
arizonaglassrepair/include/index.php
I'm guessing that one of these is the culprit. So do I just delete the entire line and upload the file, or do I have to change it to something else?
arizonaglassrepair/arizonaglassrepair.com/images/index.php
arizonaglassrepair/arizonaglassrepair.com/include/index.php
arizonaglassrepair/include/index.php
I'm guessing that one of these is the culprit. So do I just delete the entire line and upload the file, or do I have to change it to something else?
Re: Whole website redirecting to home page. Newbie help!
[ This was typed out before your second post which is directly before this one, so I'm reading that one now.... ]
No, I meant top of whichever php file actually contains the code.
Some other variations....
(also may be just a / instead of http://arizonaglassrepair.com)
This is one of those items that without being able to see the code, it is a lot of guessing since it isn't a known cms... Also, can you post the .htaccess file here, as it may also be in there.
No, I meant top of whichever php file actually contains the code.
Some other variations....
Code: Select all
header('Location:http://arizonaglassrepair.com/')
header('Location: http://arizonaglassrepair.com/')
header("Location:http://arizonaglassrepair.com/")
header("Location: http://arizonaglassrepair.com/")
header ('Location:http://arizonaglassrepair.com/')
header ('Location: http://arizonaglassrepair.com/')
header ("Location:http://arizonaglassrepair.com/")
header ("Location: http://arizonaglassrepair.com/")This is one of those items that without being able to see the code, it is a lot of guessing since it isn't a known cms... Also, can you post the .htaccess file here, as it may also be in there.
Re: Whole website redirecting to home page. Newbie help!
Those three files you list with the redirect are most likely not the problem, they redirect back to the home page so that if you browse to those directories, you get sent back to the home page since you are not designed to be directly browsed.
-Greg
-Greg
Re: Whole website redirecting to home page. Newbie help!
Update: I just deleted the three files listed in my last post, it did not fix the problem.
Re: Whole website redirecting to home page. Newbie help!
Oops, looks like we're both posting at the same time.twinedev wrote:[ This was typed out before your second post which is directly before this one, so I'm reading that one now.... ]
No, I meant top of whichever php file actually contains the code.
Some other variations....(also may be just a / instead of http://arizonaglassrepair.com)Code: Select all
header('Location:http://arizonaglassrepair.com/') header('Location: http://arizonaglassrepair.com/') header("Location:http://arizonaglassrepair.com/") header("Location: http://arizonaglassrepair.com/") header ('Location:http://arizonaglassrepair.com/') header ('Location: http://arizonaglassrepair.com/') header ("Location:http://arizonaglassrepair.com/") header ("Location: http://arizonaglassrepair.com/")
This is one of those items that without being able to see the code, it is a lot of guessing since it isn't a known cms... Also, can you post the .htaccess file here, as it may also be in there.
There are a total of seven .htaccess files, would it be the one in the home directory? If so, here it is:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^glassking.com
RewriteRule (.) http://www.glassking.com/$1 [R=301,L]
#RewriteCond %{THE_REQUEST} ^.*index.php
#RewriteRule ^(.*)index.php$ http://www.glassking.com/$1 [R=301,L]
########### Set time zone
SetEnv TZ America/Phoenix
ErrorDocument 403 http://www.glassking.com
ErrorDocument 404 http://www.glassking.com
#this for sitemap
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
RewriteRule ^sitemap\.php$ http://www.glassking.com/sitemap.xml [R=301,L]
RewriteRule ^sitemap\.xml$ sitemap\.php [L]
<Files php.ini>
order allow,deny
deny from all
</files>
<Files .htaccess>
order allow,deny
deny from all
</Files>
RewriteRule ^include/glassking\.([0-9]+)\.css$ http://www.glassking.com/include/glassking.css [L]
RewriteRule ^arizona/([^/]+)/$ http://www.glassking.com/arizona/$1.php [L]
RewriteCond %{THE_REQUEST} ^GET\ /arizona/([^/]+)\.php\ HTTP
RewriteRule ^arizona/([^/]+)\.php$ http://www.glassking.com/arizona/%1/ [R=301]
#this to add slash if end slash missing
RewriteCond %{THE_REQUEST} ^GET\ /arizona/([^/]+)\ HTTP
RewriteRule ^arizona/([^/]+)\.php$ http://www.glassking.com/arizona/$1/ [R=301]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?glassking.com/.*$ [NC]
RewriteRule \.(gif|jpg|jpeg|png)$ http://www.glassking.com/ooops/ [R,L]
Redirect permanent /services http://www.glassking.com/arizona/mobile-glass-services/
Redirect permanent /autoreplace http://www.glassking.com/arizona/auto-g ... placement/
Redirect permanent /contact http://www.glassking.com/arizona/contact-us/
Redirect permanent /repair http://www.glassking.com/arizona/auto-g ... ip-repair/
RewriteCond %{HTTP_HOST} ^glassking.com [OR]
RewriteCond %{HTTP_HOST} ^www\.glassking.com
RewriteRule ^arizonaglassrepair.com/?$ http://www.arizonaglassrepair.com/ [R=301,L]
Re: Whole website redirecting to home page. Newbie help!
OK, I guess I'll put them back then. I really appreciate the help, it's like I've been trying to solve a problem in a different language, with over 5000 files to go through.twinedev wrote:Those three files you list with the redirect are most likely not the problem, they redirect back to the home page so that if you browse to those directories, you get sent back to the home page since you are not designed to be directly browsed.
-Greg
Re: Whole website redirecting to home page. Newbie help!
Do you also have the "GlassKing.com" site??? I saw that one was in the portfolio for the person who did the site, since it was different phone number, figured it was competition.
Anyhow, there is your issue right at the bottom, the last 3 lines, they say that if the site you are visiting is NOT glassking.com OR NOT www.glassking.com, then send them to http://www.arizonaglassrepair.com
So where you go from here, depends on the first question...
-Greg
Anyhow, there is your issue right at the bottom, the last 3 lines, they say that if the site you are visiting is NOT glassking.com OR NOT www.glassking.com, then send them to http://www.arizonaglassrepair.com
So where you go from here, depends on the first question...
-Greg
Re: Whole website redirecting to home page. Newbie help!
The circumflex accent (^) in the pattern "^glassking.com" matches the beginning of the string being tested. To not match, an exclamation mark (!) would be used.twinedev wrote:Anyhow, there is your issue right at the bottom, the last 3 lines, they say that if the site you are visiting is NOT glassking.com OR NOT http://www.glassking.com, then send them to http://www.arizonaglassrepair.com
Re: Whole website redirecting to home page. Newbie help!
Opps, yep you are right, was thinking too much of regex's [^a-z] type stuff, thanks for catching that.
-Greg
-Greg
Re: Whole website redirecting to home page. Newbie help!
Wow, the site is working again. Greg, I sent you an email. I've been trying for hours to reply to your post, but I have been getting an error every time I try to post that says:
***********************
General Error
SQL ERROR [ mysqli ]
You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '' at line 1
[1064]
An SQL error occurred while fetching this page. Please contact the Board
Administrator if this problem persists.
***********************
On top of that, since I'm new to the forum I have to fill out one of those "captcha" things that works about one out of every 5 tries, it's been a very frustrating night when I'm so close to fixing this problem.
Anyway, the .htaccess file I sent you might not be the right one, there is one in the /arizonaglassrepair.com directory that looks like this:
*****************************
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
########### Set time zone
SetEnv TZ America/Phoenix
#RewriteCond %{THE_REQUEST} ^.*index.php [OR]
#RewriteCond %{THE_REQUEST} ^.*index
#RewriteRule ^(.*)index.php$ http://arizonaglassrepair.com/$1 [R=301,L]
#this for sitemap
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
RewriteRule ^sitemap\.php$ http://www.arizonaglassrepair.com/sitemap.xml [R=301,L]
RewriteRule ^sitemap\.xml$ sitemap\.php [L]
RewriteRule ^contact-us/?$ http:\/\/www\.arizonaglassrepair\.com\/ [R=301,L]
RewriteRule ^about/?$ http:\/\/www\.arizonaglassrepair\.com\/ [R=301,L]
#RewriteRule ^privacy-policy/?$ http:\/\/www\.arizonaglassrepair\.com\/ [R=301,L]
RewriteCond %{HTTP_HOST} ^arizonaglassrepair.com
RewriteRule (.*) http://www.arizonaglassrepair.com/$1 [R=301,L]
<Files php.ini>
order allow,deny
deny from all
</files>
<Files .htaccess>
order allow,deny
deny from all
</Files>
RewriteCond %{THE_REQUEST} ^GET\ /([^/]+)\.php\ HTTP
RewriteRule ^([^/]+)\.php$ http://www.arizonaglassrepair.com/%1/ [R=301]
#this to add slash if end slash missing
RewriteCond %{THE_REQUEST} ^GET\ /([^/]+)\ HTTP
RewriteRule ^([^/]+)\.php$ http://www.arizonaglassrepair.com/$1/ [R=301]
*****************************
So, I have no idea what to change, if it is this .htaccess file or the other one I posted. Please give me just a little more help, I really hope I can get this message through to you.
***********************
General Error
SQL ERROR [ mysqli ]
You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '' at line 1
[1064]
An SQL error occurred while fetching this page. Please contact the Board
Administrator if this problem persists.
***********************
On top of that, since I'm new to the forum I have to fill out one of those "captcha" things that works about one out of every 5 tries, it's been a very frustrating night when I'm so close to fixing this problem.
Anyway, the .htaccess file I sent you might not be the right one, there is one in the /arizonaglassrepair.com directory that looks like this:
*****************************
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
########### Set time zone
SetEnv TZ America/Phoenix
#RewriteCond %{THE_REQUEST} ^.*index.php [OR]
#RewriteCond %{THE_REQUEST} ^.*index
#RewriteRule ^(.*)index.php$ http://arizonaglassrepair.com/$1 [R=301,L]
#this for sitemap
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
RewriteRule ^sitemap\.php$ http://www.arizonaglassrepair.com/sitemap.xml [R=301,L]
RewriteRule ^sitemap\.xml$ sitemap\.php [L]
RewriteRule ^contact-us/?$ http:\/\/www\.arizonaglassrepair\.com\/ [R=301,L]
RewriteRule ^about/?$ http:\/\/www\.arizonaglassrepair\.com\/ [R=301,L]
#RewriteRule ^privacy-policy/?$ http:\/\/www\.arizonaglassrepair\.com\/ [R=301,L]
RewriteCond %{HTTP_HOST} ^arizonaglassrepair.com
RewriteRule (.*) http://www.arizonaglassrepair.com/$1 [R=301,L]
<Files php.ini>
order allow,deny
deny from all
</files>
<Files .htaccess>
order allow,deny
deny from all
</Files>
RewriteCond %{THE_REQUEST} ^GET\ /([^/]+)\.php\ HTTP
RewriteRule ^([^/]+)\.php$ http://www.arizonaglassrepair.com/%1/ [R=301]
#this to add slash if end slash missing
RewriteCond %{THE_REQUEST} ^GET\ /([^/]+)\ HTTP
RewriteRule ^([^/]+)\.php$ http://www.arizonaglassrepair.com/$1/ [R=301]
*****************************
So, I have no idea what to change, if it is this .htaccess file or the other one I posted. Please give me just a little more help, I really hope I can get this message through to you.
Re: Whole website redirecting to home page. Newbie help!
Yes, the guy who owns this site also owns glassking. The site arizonaglassrepair was a subdomain of glassking. I'm not sure why the old webmaster had all of those lines in there redirecting to the glassking site.twinedev wrote:Do you also have the "GlassKing.com" site??? I saw that one was in the portfolio for the person who did the site, since it was different phone number, figured it was competition.
Anyhow, there is your issue right at the bottom, the last 3 lines, they say that if the site you are visiting is NOT glassking.com OR NOT http://www.glassking.com, then send them to http://www.arizonaglassrepair.com
So where you go from here, depends on the first question...
-Greg
I've been messing with the .htaccess files, and I'm not sure exactly what happened, but now if you click on one of the links, it takes you to the glassking site. I tried putting everything back the way it was, I used backups, but it is still screwed up. I even tried copying from the post I made earlier in this forum and pasting it into the .htaccess file, but it didn't fix it. Weird. I'll probably try to upload the entire site and start over, but that's about 47MB, will take a while.
Re: Whole website redirecting to home page. Newbie help!
OK, I re-uploaded the site, everything seems to be working (as well as it was before, which means it's not working correctly). Here's what I've found:
In the root directory there is an .htaccess file, and in this file there are two lines that say -
ErrorDocument 403 http://www.glassking.com
ErrorDocument 404 http://www.glassking.com
If I change the url's in these lines to a different site, like glass.com, and then go to the home page of arizonaglassrepair.com and click on any link at the top of the page, I am redirected to whatever link is listed in these two lines. I don't understand why this is happening to, for instance, the link on the right, which shows as arisonaglassrepair .com/auto/. There is an auto.php file in the root directory, that looks like the same type of script as the index.php file, but instead of loading, it is seen as an error and redirected to the glassking site. If I put in some random letters, I go to the glassking site. Why is auto.php seen as a bad page?
That's where I'm stuck. I can take these lines out and upload the .htaccess page, and when I try to go to any links I get an error page, so that's not fixing anything. I'm guessing this is probably some majorly basic php stuff, but it's all greek to me. Any help at all would be extremely appreciated, I'm hoping someone will have pity on an old html web guy and clue me in on how I can fix this stupid website. As usual, thanks in advance.
In the root directory there is an .htaccess file, and in this file there are two lines that say -
ErrorDocument 403 http://www.glassking.com
ErrorDocument 404 http://www.glassking.com
If I change the url's in these lines to a different site, like glass.com, and then go to the home page of arizonaglassrepair.com and click on any link at the top of the page, I am redirected to whatever link is listed in these two lines. I don't understand why this is happening to, for instance, the link on the right, which shows as arisonaglassrepair .com/auto/. There is an auto.php file in the root directory, that looks like the same type of script as the index.php file, but instead of loading, it is seen as an error and redirected to the glassking site. If I put in some random letters, I go to the glassking site. Why is auto.php seen as a bad page?
That's where I'm stuck. I can take these lines out and upload the .htaccess page, and when I try to go to any links I get an error page, so that's not fixing anything. I'm guessing this is probably some majorly basic php stuff, but it's all greek to me. Any help at all would be extremely appreciated, I'm hoping someone will have pity on an old html web guy and clue me in on how I can fix this stupid website. As usual, thanks in advance.
Last edited by hoyaguru on Sun Jul 10, 2011 12:11 am, edited 1 time in total.