htaccess or ci problem on sub domain ?

#1
[eluser]hardik[/eluser]
hi friends,

i am having problem configuring codeigniter on one sub domain of my site. here is the details.

e.x http://xyz.abc.com/ is the domain where i have installed codeigniter. it is installed
successfully. after that i have created another controller blog

http://xyz.abc.com/index.php/blog
which is also accessible at this point.

now problem is i want to remove index.php from url

so first of all i have set configuration in config.php like this

Code:
$config['base_url']    = "http://xyz.abc.com/";
$config['index_page'] = "";

and also set htaccess by following code

Code:
Options FollowSymLinks
<IfModule mod_rewrite.c>
    RewriteEngine on    
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

but when i type following

http://xyz.abc.com/blog

i still get the welcome controller.

anyone can help me with this ?

#2
[eluser]rogierb[/eluser]
Your .htaccess looks fine. One thing I notice is that you redirect every 404 to index.php

So if there is an error or mod_rewrite is not instelled, you go to index.php and thus your welcome conroller.
Try changing that to see if mod_rewrite is functioning properly

#3
[eluser]hardik[/eluser]
i just changed the htaccess file as you suggested

Code:
Options FollowSymLinks
<IfModule mod_rewrite.c>
    RewriteEngine on    
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /404.html
</IfModule>

but still no sign of success Sad

#4
[eluser]hardik[/eluser]
thanks for the help Smile

its working now

i found i need to write my htaccess in following manner

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|public|user_guide|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]

and now it's working.

thanks for the help Smile

#5
[eluser]hardik[/eluser]
got into another trouble...

i have setup config variable

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

now see this url
Code:
http://xyz.abc.com/blog/verify.html

see the problem Sad

i have printed url segments and i found this controller function

should be verify() but it is verify_html

how this can happen ?

any one to help ?

function verify() is there but it throws an 404 error so i use this code to debug problem in controller constructer itself...

Code:
echo $this->uri->slash_segment(1);
        echo "<br>";
        echo $this->uri->slash_segment(2);
        echo "<br>";
        echo $this->uri->slash_segment(3);
        echo "<br>";
        echo $this->uri->slash_segment(4);
        echo "<br>";
        echo $this->uri->slash_segment(5);
        exit(0);

#6
[eluser]hardik[/eluser]
solution was remove AUTO option from config file and use

Code:
$config['uri_protocol']    = "REQUEST_URI";


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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