Welcome Guest, Not a member yet? Register   Sign In
Problem with htaccess
#1

[eluser]kbkb[/eluser]
Hi - I use the htaccess from here: http://ellislab.com/codeigniter/user-gui.../urls.html

Advanced it for my uses, in special my css-files:
Code:
AddHandler php5-cgi .php
RewriteEngine on
RewriteCond $1 !^(index\.php|img|robots\.txt|style\.css|reset\.css|typography\.css|forms\.css|ie\.css)
RewriteRule ^(.*)$ /index.php/$1 [L]

It works fine, if i use a sub-link like: blog/category/1

But it dont work in the root of my directory. When I call http://mydomain/
Then i got 3 times the following error:

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 0

Filename: libraries/Router.php

Line Number: 201


Whats the problem?? Sad



Annother Issue:
I wanna use
RewriteRule ^(.*)\.html$ /index.php/$1
that all my Pages can be accessed by .html as equal as without .html.

I tried:
Code:
RewriteRule ^(.*)\.html$ /index.php/$1 [L]
RewriteRule ^(.*)$ /index.php/$1
It dont work - why? When it found something with .html on the end, it should apply it to the index.php and this is the last rule. If it dont find something it eval the next rule and make the normal mapping.


The funny thing is: both of the rules work for their specific case. But they dont work together at the same time.

When I use only the rule with .html on the end, i don't get my error from above.
#2

[eluser]umefarooq[/eluser]
i have attached .htaccess file in message try this one it will work fine and another thing if you want to add .html to your site url no need to change in .htaccess file you have to change in your application/config file

Code:
$config['url_suffix'] = ".html";

it will add .html to your urls

.htaccess file
Code:
# Deny OR Allow Folder Indexes.
# Since we disable access to PHP files you
# can leave this on without worries.
# OR better yet, create a .htaccess file in
# the dir you want to allow browsing and
# set it to +Indexes
Options -Indexes

Options +FollowSymLinks

# Set the default file for indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>
    # mod_rewrite rules
    RewriteEngine on

    # The RewriteBase of the system (if you are using this sytem in a sub-folder).
     #RewriteBase /sitefolder/
    
    # This will make the site only accessible without the "www."
    # (which will keep the subdomain-sensive config file happy)
    # If you want the site to be accessed WITH the "www."
    # comment-out the following two lines.
    # RewriteCond %{HTTP_HOST} ^www\.site\.com$ [NC]
    # RewriteRule ^(.*)$ http://site.com/$1 [L,R=301]
    
    # If a controler can't be found - then issue a 404 error from PHP
    # Error messages (via the "error" plugin)
    # ErrorDocument 403 /index.php/403/
    # ErrorDocument 404 /index.php/404/
    # ErrorDocument 500 /index.php/500/
    
    # Deny any people (or bots) from the following sites: (to stop spam comments)
    # RewriteCond %{HTTP_REFERER} nienschanz\.ru [NC,OR]
    # RewriteCond %{HTTP_REFERER} porn\.com
    # RewriteRule .* - [F]
    # Note: if you are having trouble from a certain URL just
    # add it above to forbide all visitors from that site.

    # You can also uncomment this if you know the IP:
    # Deny from 192.168.1.1
    
    # If the file is NOT the index.php file
    RewriteCond %{REQUEST_FILENAME} !index.php
    # Hide all PHP files so none can be accessed by HTTP
    #RewriteRule (.*)\.php$ index.php/$1
    
    # If the file/dir is NOT real go to index
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteCond %{REQUEST_URI} !/admin_asset
    RewriteRule ^(.*)$ index.php/$1 [L]
    
</IfModule>

# If Mod_ewrite is NOT installed go to index.php
<IfModule !mod_rewrite.c>
    ErrorDocument 404 index.php
</IfModule>
#3

[eluser]kbkb[/eluser]
Thank you very much! It works!! Smile
#4

[eluser]Unknown[/eluser]
Hi, it doesn't work for me, the only thing it does is to print "index.php" on the screen, I just copied/pasted your code, what may be the problem? Thanks in advance




Theme © iAndrew 2016 - Forum software by © MyBB