Welcome Guest, Not a member yet? Register   Sign In
problem with removing index.php
#21

[eluser]citm[/eluser]
In xampp is running OK but in shared hosting (Red hat 4) doesn't work.
#22

[eluser]pioSko[/eluser]
I may have found the problem.. not sure.

It seems that the .htaccess file is trying to redirect one level too high or actually to the Document Root Apache has setup.

Since most people don't have one site in their root but many, these sites are all in their own folders. Therefore, you don't have...

http://localhost/index.php

but

http://localhost/testsite/index.php


Now, when the .htaccess file is redirecting, it's going all the way back to http://localhost/index.php
... am I thinking right??? lol

That's what's happened to me when I testing on a live server.. I got the index file of my root site.

Can anyone suggest a proper fix for the .htaccess file or just go with the flow and delete the RewriteBase /

??

cheers.
#23

[eluser]BitRanch[/eluser]
[quote author="pioSko" date="1201891280"]Therefore, you don't have...

http://localhost/index.php

but

http://localhost/testsite/index.php

...

Can anyone suggest a proper fix for the .htaccess file or just go with the flow and delete the RewriteBase /
[/quote]

Your question contains the answer. If "testsite" is always part of the url, then that's part of the base url. The "RewriteBase /" is for a site that's rooted at the hostname. If it's rooted in some folder below that, you need to add the folder. For your example, you'd use:

RewriteBase /testsite/

(That's even referenced on the mod_rewrite wiki page: "Note: If your site is placed in subfolder specify the path in the “RewriteBase /subfolder/” line.")
#24

[eluser]pioSko[/eluser]
That's what I meant... And you gave the answer Wink

As I said, most devs have many sites in their DirectoryRoot therefore that RewriteBase was going to root of the WHOLE server not the site.
#25

[eluser]Unknown[/eluser]
This works for me. I'm an Ubuntu 7.10 User, and my server works with Apache2, I follow this steps to remove index.php from URL.

1.- Create and .htaccess to the same directory as index.php with this content:

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

2.- Open Apache configuration file.

Code:
sudo vi /etc/apache2/httpd.conf

3.- Add this, change /var/www/web with the link of your website.

Code:
<Directory /var/www/web >
    Options FollowSymLinks
    AllowOverride All
</Directory>

4.- Finally restart Apache:

Code:
sudo /etc/init.d/apache2 restart

I hope it'll be helpful
#26

[eluser]Unknown[/eluser]
OK, I tested this and worked for me on both wamp and xampp server for windows.
So, try this:

apache rewrite_module is loaded.

edit config.php like this:

Code:
$config['base_url'] = "http://localhost/>>YOUR_DIR_NAME<</";

$config['index_page'] = "";

and edit .htaccess file like this :
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    #RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

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

[eluser]Unknown[/eluser]
[quote author="ekeretex" date="1201020635"]Does the url work with the index.php in it?
Remove the if condition and see if that works. It think the loaded module for my setup is mod_rewrite.so. Not sure if that's the same but I don't use the conditional with mine.
Code:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
If that doesn't work comment out the RewriteBase line and try again.[/quote]

That works perfectly for me. Thanks!
#28

[eluser]mjsilva[/eluser]
Yesterday I've encounter some problems in Windows Vista & WAMP regarding htaccess.

The first one is as simple as creating a file called .htaccess if you try to create in explorer windows will complain that name is not valid for a file, the workarround:

Open Notepad writte down the line as described in user manual and save as.. .htaccess (don't forget to change file type to ALL) in the site root directory.

The second problem that I have was the module mod_rewrite not being on for default in Apache, is always good to check errors.log from apache when something fails or isn't working as it should.


After correcting this two problems mod_rewrite as been working flawless.

Oh! and other thing in $config['base_url'] don't forget to add the folder for your website, something like $config['base_url'] = "http://localhost/CI";
#29

[eluser]xavieremerson[/eluser]
hi....

I'm also new to this could you help me too...

Sorry for disturbing...

I'm also needs to remove index.php from url...

if your busy please send .htaccess content. Also i need to know that, after writing htaccess file how how url is to be used..

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]


I'm also tried this...

I don't know ... anything about it please help me...
thankz in advance....
#30

[eluser]indrajit_l[/eluser]
hi Xavier

1.
enable mod_rewrite in your apache module

2.
create an .htaccess file at the root of your directory (where your root index.php is stored that location) and update that with the following


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /codeigniter/ <<this would be your directory name containing the index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

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

this way is working ok for me, I am running apache 2.2 on win XP




Theme © iAndrew 2016 - Forum software by © MyBB