Welcome Guest, Not a member yet? Register   Sign In
Strange URL Suffix behavior
#1

[eluser]theprodigy[/eluser]
I have an htaccess file in place that gets rid of the need for "index.php" in the URL. All is working great......except for the URL Suffix. If I set $config['url_suffix'] = "html", it works fine. My controllers appear as homehtml, abouthtml, etc, and CI renders them as it's supposed to; but as soon as I set it equal to ".html" (I add the dot), the links render correctly (they become home.html, about.html, etc), but when I try to visit the page, I get a 404.

The file setup that I am using is:
/CI
-/application
- -/hypertext
- - -/config
- - -/controllers
- - -/etc
-/system
- -/cache
- -/codeigniter
- -/etc
/public_html
-/HyperText
- -/css
- -/images
- -/js
- -index.php
- -.htaccess


I have one domain name that points to public_html, and one domain name that points to HyperText (HyperText is the one that is causing this strange behavior). The HyperText folder is the root of that domain

Not sure if this will help any, but I am using BlueHost as my hosting.

I'm not sure if the htaccess file is what is stopping me or not but here it is just in case:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

Thanks in advance for your help
#2

[eluser]theprodigy[/eluser]
OK, I have an update. When I change the url_suffix to be ".html" (with the dot), it works just fine if I include index.php in the url, but without the index.php it goes to a 404. If I set the url suffix to be anything other than something starting with a dot, I don't need the index.php. I'm guessing this has something to do with my htaccess file?

Once again, thanks in advance for any help you can offer
#3

[eluser]Dam1an[/eluser]
I just tested with a .html suffix, and it works fine for me, my .htaccess is
Code:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico|license.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
#4

[eluser]theprodigy[/eluser]
I just changed my htaccess file to look like yours, and now it is causing my site to act strange. No matter what link I click on, I see the home page.

My Site is HyperText Web Design

I've never run into this before.

I'm wondering if it has something to do with the folder layout, web root (one inside the other, which one goes in htaccess?), and htaccess.

The way Blue Host does their Add On domains is really strange. Not only do they setup the folder inside of the webroot of your main domain, but the also setup a sub-domain.

You can get to the same home page by going to 3 different places:

www.hypertextwebdesign.com
hypertext.grargs.com
www.grargs.com/HyperText

Not sure if that affects the htaccess or not.
#5

[eluser]Dam1an[/eluser]
My directory structure is
Code:
- CodeIgniter_1.7.1
- htdocs
  - site_name
    - .htaccess
    - config
    - controllers
    - css
    - errors
    - helpers
    - hooks
    - images
    - index.php
    - js
    - language
    - libraries
    - license.txt
    - models
    - views
#6

[eluser]theprodigy[/eluser]
so, if it's not the folder structure, or the htaccess file (since I am using the one you posted), what else could it be? There is only one other htaccess file on the server (in the public_html folder), but all it does is: AddHandler application/x-httpd-php5 .php

What else could it be?
#7

[eluser]theprodigy[/eluser]
ok, I turned CI's log threshold to 4 (log everything). Here is what the system log shows:

Code:
DEBUG - 2009-05-26 09:32:50 --&gt; Config Class Initialized
DEBUG - 2009-05-26 09:32:50 --&gt; Hooks Class Initialized
DEBUG - 2009-05-26 09:32:50 --&gt; URI Class Initialized
DEBUG - 2009-05-26 09:32:50 --&gt; No URI present. Default controller set.
DEBUG - 2009-05-26 09:32:50 --&gt; Router Class Initialized
DEBUG - 2009-05-26 09:32:50 --&gt; Output Class Initialized
DEBUG - 2009-05-26 09:32:50 --&gt; Input Class Initialized
DEBUG - 2009-05-26 09:32:50 --&gt; Global POST and COOKIE data sanitized
DEBUG - 2009-05-26 09:32:50 --&gt; Language Class Initialized
DEBUG - 2009-05-26 09:32:50 --&gt; Loader Class Initialized
DEBUG - 2009-05-26 09:32:50 --&gt; Helper loaded: html_helper
DEBUG - 2009-05-26 09:32:50 --&gt; Helper loaded: url_helper
DEBUG - 2009-05-26 09:32:50 --&gt; Database Driver Class Initialized
DEBUG - 2009-05-26 09:32:50 --&gt; Controller Class Initialized
DEBUG - 2009-05-26 09:32:50 --&gt; File loaded: /home3/grargsco/CI/application/hypertext/views/home.php
DEBUG - 2009-05-26 09:32:50 --&gt; File loaded: /home3/grargsco/CI/application/hypertext/views/template.php
DEBUG - 2009-05-26 09:32:50 --&gt; Final output sent to browser
DEBUG - 2009-05-26 09:32:50 --&gt; Total execution time: 0.0403

Upon seeing "No URI present. Default controller set.", I put a line of code at the top of the home controller to output the uri string, followed by a break tag. Then I clicked on some links. The only thing outputting is the break tag. No uri string whatsoever. So, there is definitely something not working right here.

Any ideas?
#8

[eluser]Dam1an[/eluser]
Have you tried all the differant URI protocols?
#9

[eluser]theprodigy[/eluser]
not exactly sure what you mean by trying all URI protocols, but I modified what I'm outputting at the top of the home controller to:
Code:
echo $this->uri->uri_string()."<br />";
echo $this->uri->ruri_string()."<br />";

Now, I get a blank line at the top (due to break tag), and then "/home/index/" (which is the URI segments that it is routing me to).

What else can I try? Please explain your question about URI protocols.

Thanks
#10

[eluser]Dam1an[/eluser]
3rd item down in the config file
Try all the options




Theme © iAndrew 2016 - Forum software by © MyBB