CodeIgniter Forums

Full Version: Rewrite URL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]namnd[/eluser]
Hi guys,

I am developing a website for a client with CI framework.
I am using .htaccess to remove index.php from all the URLs within the site.
The site is almost finished and the client want to test it on their dedicated server.
So what I got from them is the server login with a dedicated IP address.

I have upload the website to the server, but there is no domain added to the server yet, so I got the link to the website is something like

http://119.31.231.42/~username

The first page is coming up all fine, all images, text from database, everything is working.

But then I click on one of the menu to go to other page, eg
http://119.31.231.42/~username/about

This error message comes up

404 Not Found

The server can not find the requested page:

119.31.231.42/~username/about (port 80)

Please forward this error screen to 119.31.231.42's WebMaster.
Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.9 Server at 119.31.231.42 Port 80

I have check and the mod_rewrite was enabled, so I have no idea how to solve this one.

If anyone have a clue, please help.

Thanks a lot

El Forum

[eluser]flaky[/eluser]
did you check your config.php, this line
Code:
$config['base_url'] = "http://119.31.231.42/~username/";
to be as your server url

El Forum

[eluser]namnd[/eluser]
Yes, I did so

El Forum

[eluser]flaky[/eluser]
does it work if you call it like this
Code:
http://119.31.231.42/~username/index.php/about

El Forum

[eluser]namnd[/eluser]
Thanks flaky, i appreciate your reply

Yes, it works sometimes if I put the index.php in the URL
The thing is in the whole website (all controller, view) I don't use index.php
So I don't really want to fix all the URL

Do you have any other idea?

El Forum

[eluser]Dyllon[/eluser]
what does your .htaccess look like and did you set your $config['index_page'] to be blank in config.php?

El Forum

[eluser]namnd[/eluser]
[quote author="Dyllon" date="1263273588"]what does your .htaccess look like and did you set your $config['index_page'] to be blank in config.php?[/quote]
Yes, I did that.

And my .htaccess

RewriteEngine on

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


Any other idea, please help
Thanks guys

El Forum

[eluser]Rick Jolly[/eluser]
Try with the RewriteBase set like so:
Code:
RewriteEngine on
RewriteBase /~username/

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

El Forum

[eluser]namnd[/eluser]
Thanks Rick, you are my hero, works like a charm

Thanks a lot guys