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

[eluser]kongfjong[/eluser]
Hey out there

As I'm new to Code Igniter, I wanted to make a htaccess file, that removes the index.php? part of the uri. I found the following guide http://codeigniter.com/wiki/mod_rewrite/ which works great.

The thing is though, that I already have a htaccess file with the following content:

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^footballground.dk$
RewriteRule ^(.*)$ "http\:\/\/www\.footballground\.dk\/$1" [R=301,L]

This is content generated by my site-providers control panel, and redirects all requests for footballground.dk to www.footballground.dk as wanted to make sure, that all users arrive at the www version of the domain.

But I'm failing to mix the two different contents and I'm hoping you can help.

So, I still want to get rid of the index.php? part of the uri and still want every user to end up at the www version of the domain Smile
#2

[eluser]Jaketoolson[/eluser]
Code:
RewriteEngine on

RewriteCond %{HTTP_HOST} ^footballground.dk$
RewriteRule ^(.*)$ "http\:\/\/www\.footballground\.dk\/$1" [R=301,L]  

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

[eluser]kongfjong[/eluser]
Works like a charm, thanks.

But what about all the other stuff from the link? This stuff

Code:
#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]
    
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#4

[eluser]Jaketoolson[/eluser]
Are you using CI 2.0?

Basically those rules just mean if someone were to manually type into the url (trying to gain access to the CI system/application folders) :

http://www.footballground.dk/application/
or
http://www.footballground.dk/system/

They'd get booted and redirected to the homepage. I don't use these...
#5

[eluser]kongfjong[/eluser]
Yes I do Smile




Theme © iAndrew 2016 - Forum software by © MyBB