[eluser]dadamssg[/eluser]
so i want my urls to be clean and i thought they were. i put something in my .htaccess file at my root so i could go to
mysite.com/blog
instead of
mysite.com/CodeIgniter/index.php/blog
and then i set my config file like so
Code:
$config['base_url'] = "http://mysite.com/CodeIgniter/";
but now when i submit a form on one of my controllers it goes to
http://mysite.com/CodeIgniter/index.php/mains
which pulls up and displays the right page
but how the heck do i get the"/CodeIgniter/index.php" out of there for good?
[eluser]T I[/eluser]
but how the heck do i get the”/CodeIgniter/index.php” out of there for good?
simple:
change: $config['base_url'] = "http://mysite.com/CodeIgniter/"; to
$config['base_url'] = "http://mysite.com/";
and $config['index_page'] = "";
you can write your htaccess like this:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|stylesheets|javascript|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
[eluser]dadamssg[/eluser]
didn't work. if i type in mysite.com/blog it goes to my index.php frontpage of my website...
[eluser]WebsiteDuck[/eluser]
Use the .htaccess you were using before
Then in /application/config/config.php
Change your index_page like so:
Code:
$config['index_page'] = "";
[eluser]dadamssg[/eluser]
i did that and instead of having urls like this
mysite.com/CodeIgniter/index.php/main/sports
it was like this with a 404
mysite.com/CodeIgniter/main/sports
i have this mod_rewrite in my .htaccess file
Quote:<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} ^codeigniter/system.*
RewriteRule ^(.*)$ /CodeIgniter/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 ^(.*)$ /CodeIgniter/index.php?/$1 [L]
</IfModule>
and my base url in my config file is
$config['base_url'] = "http://mysite.com/CodeIgniter/";
[eluser]Cro_Crx[/eluser]
This line:
Should be the folder where your CI application is in. At the moment it's saying it's in the root directory. From your URI That doesn't seem to be the case. If your project is within the 'CodeIgniter' folder then change it to
Code:
RewriteBase /CodeIgniter
The two lines you've altered to have the CodeIgniter path should be changed back to what they were originally. Here's a full working config:
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /CodeIgniter
#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>
[eluser]dadamssg[/eluser]
you're a genius. THANK YOU Cro_Crx