Lots of 301/302 references on homepage

Hi all,

I’m hoping someone can help me as I’m a little out of my depth.

On a site I’m working on when I look at it if Firebug (using the Net tab) there is a lot of 301/302 redirects for the file /images and I am unsure why.

Someone suggested that it could be due to what’s in my .htaccess file but I’m not sure as there is only a few lines of code in there.

Any suggestion to why this would occur?

Thanks in advance

Dan,

The image is too small to be useful (even when opened in the browser), however, it’s likely that your .htaccess has some Redirects or RewriteRules which utilize REGEX. Please post your .htaccess file.

Regards,

DK

Hi DK,

sorry for the small file size,

Here is the file

DirectoryIndex home.php index.php index.html index.htm

# If you would like X-Cart to show informative message for errors caused 
# by opening of missing/deleted files (HTTP Error 404), please uncomment
# the line below.
# ErrorDocument 404 /404.php

# NOTE: If you installed X-Cart into a subfolder (for example, to /store folder, so
# it is available at http://www.example.com/store/home.php), you need to specify
# full relative path to the 404.php script, for example, as follows:
# ErrorDocument 404 /store/404.php

# Show default error document for 404 errors caused by opening of image/media files.
<Files ~ "\\.(gif|jpe?g|png|js|css|swf|ico)$">
	ErrorDocument 404 default
</Files>

ErrorDocument 401 default

# ------------------------------------
# CDSEO Pro
# ------------------------------------
# This directory index is recommended to replace the
# x-cart default within this .htaccess file
DirectoryIndex home.php index.html index.php

# Enable mod rewrite engine
RewriteEngine On


# .htpasswd protection
# May be required if your htpasswd files are located below document root (i.e. cpanel)
# Remove # at the beginning of this line if your unable to access password protected folders:
ErrorDocument 401 "Unauthorized"

# Some servers require this Options directive to be disabled
# Remove # at the beginning of this line to disable:
#Options -Multiviews

# Some servers require the Rewritebase directive to be enabled
# Remove # at the beginning of this line to enable:
# RewriteBase /


RewriteCond %{REQUEST_URI} !^/(payment|admin|provider|partner)/
RewriteCond %{REQUEST_FILENAME} !\\.(gif|jpe?g|png|js|css|swf|php|ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ cdseopro.php

# ------------------------------------
# / CDSEO Pro
# ------------------------------------

Thanks in advance

Dan,

No worries.

Other than the duplicated DirectoryIndex, I don’t see any major problems with your .htaccess other than the Apache 1.x UNIQUE !^/ in the first RewriteCond.

Regards,

DK

Can I remove the ^ this as maybe this is causing the issue?

Dan,

No. If you’re in the .htaccess file and using Apache 1.x, use ^/ but, if you’re using Apache 2.x, use ^. If you don’t know, use ^/?.

I doubt that’s causing the issue but it certainly isn’t helping matters.

Regards,

DK

Thank for that, I’m currently running Apache 2.2.14

I’ll run a test.

Hmm no change, the redirects have me stumped.

Dan,

Okay, let me explain your .htaccess (as I understand it) and see if you can come up with something I’m missing:

DirectoryIndex home.php index.php index.html index.htm
[indent][I]Sets default scripts[/I][/indent]
# If you would like X-Cart to show informative message for errors caused 
# by opening of missing/deleted files (HTTP Error 404), please uncomment
# the line below.
# ErrorDocument 404 /404.php

# NOTE: If you installed X-Cart into a subfolder (for example, to /store folder, so
# it is available at http://www.example.com/store/home.php), you need to specify
# full relative path to the 404.php script, for example, as follows:
# ErrorDocument 404 /store/404.php

# Show default error document for 404 errors caused by opening of image/media files.
<Files ~ "\\.(gif|jpe?g|png|js|css|swf|ico)$">
	ErrorDocument 404 default
</Files>
[indent][I]Incorrectly sets ErrorDocument for 404 code as default - which SHOULD be an absolute link within your "webspace."[/I][/indent]

ErrorDocument 401 default
[indent][I]Ditto[/I][/indent]

# ------------------------------------
# CDSEO Pro
# ------------------------------------
# This directory index is recommended to replace the
# x-cart default within this .htaccess file
DirectoryIndex home.php index.html index.php
[indent][I]RESETS the default script[/I][/indent]

# Enable mod rewrite engine
RewriteEngine On
[indent][I]Takes mod_rewrite OUT of comment mode[/I][/indent]

# .htpasswd protection
# May be required if your htpasswd files are located below document root (i.e. cpanel)
# Remove # at the beginning of this line if your unable to access password protected folders:
ErrorDocument 401 "Unauthorized"
[indent][I]VALID: provides message: "Unauthorized" on unauthorized request[/I][/indent]

# Some servers require this Options directive to be disabled
# Remove # at the beginning of this line to disable:
#Options -Multiviews

# Some servers require the Rewritebase directive to be enabled
# Remove # at the beginning of this line to enable:
# RewriteBase /


RewriteCond %{REQUEST_URI} !^(payment|admin|provider|partner)/
[indent][I]If NOT payment/ or admin/ or provider/ or partner/[/I][/indent]
RewriteCond %{REQUEST_FILENAME} !\\.(gif|jpe?g|png|js|css|swf|php|ico)$
[indent][I]If NOT a gif, jpeg, jpg, png, js, css, swf, php or ico file (extension)[/I][/indent]
RewriteCond %{REQUEST_FILENAME} !-f
[indent][I]If the request doesn't exist as a file[/I][/indent]
RewriteCond %{REQUEST_FILENAME} !-d
[indent][I]If the request doesn't exist as a directory[/I][/indent]
RewriteCond %{REQUEST_FILENAME} !-l
[indent][I]If the request doesn't exist as a symbolic link[/I][/indent]
RewriteRule .? cdseopro.php
[indent][I]Rewrite EVERYTHING else to cdseopro.php - note that I changed the regex as the atom created wasn't being used, i.e., it did NOTHING more than .? does.[/I][/indent]

# ------------------------------------
# / CDSEO Pro
# ------------------------------------

There is nothing there that is critical to redirections like you’re describing. Can you please COPY the text of that Firebug output?

Regards,

DK

Hi dklynn,

Thanks for your help, here is the text from firebug which does not seem right,

GET images? http://xxx.xxx.xxx.xxx/images/? 302 Moved Temporarily

just over and over and over.

I have no idea why.

Dan,

There is NOTHING in your code which would redirect images - except in the event that the images requested do not exist (as linked). Check your links is the only suggestion I can offer.

Regards,

DK

And check this images.php file that is called every time. It might also be that that file is doing the redirecting itself using PHP’s [fphp]header[/fphp] function.

Thanks for the suggestion,

I’ll have a look into it now, I am just a little lost to what image is that size.