website not opening in some devices

Hi,

My website is working fine in some devices, but some devices it is showing file listing with "index of" in the web page, while web site is working fine on other server, My website in on Codeigniter php. Please help on the issue ASAP . As tries many things but still not working on some devices.

8 Replies

This sounds like a browser caching issue… I would suggest that, on the devices where your site is not showing properly, blow the browser cache using whatever method the particular browser on that device gives you to do that. Then, try again.

On Safari/Mac, the option is Safari -> Preferences -> Privacy -> Manage Website Data… -> Remove All. On iOS, it's Settings -> Safari -> Clear History and Website Data.

-- sw

Hi Thanks for the instant reply, but still facing the same issue, approx 20 devices I had tested, working fine with 15 but showing index of like file listing for others, I had moved the code on one testing server, there everything is working fine, something very strange which I am getting, tried everything, Please help on this as sucked from last one month. website URL is http://tripapna.com/ .

Hi, Can anyone plz help on this. as I need help on urgent basis for the same.

Can you post the .htaccess file or the apache2 configuration for this?

-- sw

P.S. Don't post your whole apache2 configuration…just the configuration for the directory you set as DocumentRoot (the directory that is served as /).

P.P.S. Did you clear the browser cache on the 5 problem devices completely? Sometimes you have to do it multiple times (esp. if you use Firefox).

Hi Stevewi,

Thanks for the reply.

Below is the htaccess
RewriteEngine On

RewriteCond %{REQUEST_URI} ^/system.*

RewriteRule ^(.*)$ index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.+)$ index.php?/$1 [L]

root directory is /home/tripapna/public_html

Yes I had cleared cache in all devices, I noticed when I am opening just a testing php file from the server, browser showing complete PHP page. Please help on this.

Sorry to be pedantic but the first question you should ask yourself is Is mod_rewrite enabled?. I'm assuming so since you don't report any errors about unknown directives or some such…

You write:

1. RewriteEngine On
2. RewriteCond %{REQUEST_URI} ^/system.*
3. RewriteRule ^(.*)$ index.php?/$1 [L]
4. RewriteCond %{REQUEST_FILENAME} !-f
5. RewriteCond %{REQUEST_FILENAME} !-d
6. RewriteRule ^(.+)$ index.php?/$1 [L]

I added the numbers to make reference easier. My initial reaction is that Rules 3 and 6 seem to be at odds. What I would do would be to eliminate Rule 6 and move Rule 3 to the bottom…like this:

1. RewriteEngine On
2. RewriteCond %{REQUEST_URI} ^/system.*
3. RewriteCond %{REQUEST_FILENAME} !-f
4. RewriteCond %{REQUEST_FILENAME} !-d
5. RewriteRule ^(.*)$ index.php?/$1 [L]

Of course, I'm not guaranteeing that this will fix your problem, mind you, but at least your rewrite rules will be consistent. Since I don't have access to your system, that would be hard for me to do… In order to understand these completely, you can read here:

https://httpd.apache.org/docs/2.4/rewrite/

(this URL should explain the difference between ^(.*)$ and ^(.+)$ and what [L] does).

You can log what the rewrite rules do and which get hit in which circumstances using the technique outlined here:

http://www.techytalk.info/debug-apache-mod_rewrite-by-enabling-logging-feature/

Also, you pick up these (excellent, IMHO) ebooks:

Rich Bowen is the developer of mod_rewrite.

-- sw

Hi Stevewi,

Thanks for reply, yes mod_rewrite enabled, still the problem persist as in some devices still the website not opening, actually had done some changes in .htaccess whatever suggestion I got from stackoverflow to resolve the issue, but still the issue is there.

The fact that your problem only manifests on some devices but not others really vexes me… Are all devices using the same browser and version? If not, I would say you are experiencing some weird browser bug (not uncommon if you are using IE).

The only other suggestion I have is to change Rule 5 above from:

5. RewriteRule ^(.*)$ index.php?/$1 [L]

to

5. RewriteRule ^(.*)$/ index.php?/$1 [L]

Another thing you could try is get rid of +MultiViews in any Options specification on the <Directory>...</Directory spec for the url.

If this doesn't work, I'm fresh out of ideas. Is your site developed with some kind of PHP framework like CodeIgniter or Fat-Free Framework or (shudder!) WordPress? If so, I'd suggest contacting them.

-- sw

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct