Welcome Guest, Not a member yet? Register   Sign In
Mod Rewrite works if site is in a sub directory but not in the root
#1

[eluser]Ty Bex[/eluser]
When i designed the website it was on my server http://www.domainname.com/DEV/ and the mod rewrite worked fine.
Code:
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|    http://example.com/
|
*/
$config['base_url']    = "http://www.domainname.com/DEV/";

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = "";

Since I moved it to the new website. http://www.plymouthparksoccer.org/ I had to load in the index_page variable for the site to work.
Code:
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|    http://example.com/
|
*/
$config['base_url']    = "http://www.plymouthparksoccer.org/";

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = "index.php";


The Mod requite is being picked up because if I mess up the syntax is throws a server error.
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond $1 !^(index\.php|public|images|tmp|robots\.txt|css)
    RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>

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

If I do not load the index_page variable with index.php. The links will all show correctly but it only displays the home page no matter what the address bar states.

The site right now is working with the index.php assigned but I would really love to know why it works if the site is in a sub directory and not if the site is in the root of the domain.


Messages In This Thread
Mod Rewrite works if site is in a sub directory but not in the root - by El Forum - 05-04-2009, 09:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB