• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Second display gives 404 error on style sheet

[quote author="InsiteFX" date="1334788810"]
<link rel="stylesheet" href="<?php echo base_url('assets/styles/site_style.css');?>" />
The reason why I don't like that is you can't then just use base_url() for BOTH SSL and non SSL links/assets (without changing config before use). Like if you only have SSL enabled on your "checkout" page but the rest are normal. Just starting the url with "/" will work in both cases.

Good point CroNix, I have not had to use SSL yet but thanks for the poniter...

@CroNix, yours look plausible, but it doesn't work for me in localhost.. but maybe it will work in production?

So I would access my local website as http://localhost/website/ with the below for my htaccess file

RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|js|stylesheets|scripts|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /website/index.php/$1 [L]

It's because you have your dev site in a subdirectory (and so document root is wrong as its not pointing to your subdirectory). It's quite helpful to set up virtual hosts in apache, one for each project, and set the document_root to that directory so you don't have to worry about a subdirectory and your dev site will work just like the live site would. You would access it by http://yoursite.localhost instead of http://localhost/website.

Personally, I like to have my production env and dev env the same and avoid inconsistencies like this.

Sorry for the digression in topic, but others who will try to enable SSL may find the below helpful.

@CroNiX. Could you share with me how you setup your .htaccess? I was able to setup an apache vhost. The home page loads, but assets are still being fetched via http://localhost/mysite

Here's what id did.
1) on my mac with MAMP, edited my /etc/hosts file and added the below.
Code: mysite.local

2) Then, I added the below to my httpd.conf file

NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Applications/MAMP/htdocs"
<VirtualHost *:80>
ServerName mysite.local
DocumentRoot "/Applications/MAMP/htdocs/mysite"

3) then I tried accessing "mysite.local" but httpd threw this error: "Request exceeded the limit of 10 internal redirects due to probable configuration error"

4) So, changed the following in my htaccess.
'RewriteRule ^(.*)$ /mysite/index.php/$1 [L]' => 'RewriteRule ^(.*)$ /index.php/$1 [L]'

I restart apache, and when I access mysite.local, the homepage loads but interior links redirect to "localhost/mysite"

Any thoughts on the issue?

Did you change your base_url in config to be either blank (autodetect) or http://mysite.local/?

This is the htaccess I use for all CI projects:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

In your vhost entry, you might also need:
Options +FollowSymLinks

@CoNix. You are a godsend gift to this community!! I really appreciate your help, and so many others too. I uploaded my modified template view (using relative URLs) to the CI website, switched the URL to HTTPS, and like magic, it works!! The browser padlock shows without errors/warnings.

**** I submit that if ANYONE plans on HTTPS/SSL enabling his/her CI website in the future, follow the directions in this thread. Setup a vhost (maybe for all your projects), and avoid CI helper functions for loading css, jpg, js files, etc. *****

Many thanks again!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.