Welcome Guest, Not a member yet? Register   Sign In
htaccess and URL rewrite FAIL
#1

[eluser]mmcglynn[/eluser]
I use Joyent hosting. This is my first Codeigniter application.

I am trying to rewrite the URLs to remove the index.php. Each time I add the .htaccess file, no pages will load. Yes, I set $config['index_page'] to an empty string.

My folder structure looks like this:

ci_system
public /* this is publicly accessible folder */
> ci_application
> index.php

I have used both the comprehensive .htaccess file on the Wiki (the one with the logic) and this simple example:

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


In each case I get page not found errors. What am I doing wrong? I am going crazy with this. Why is it so hard?
#2

[eluser]joedy[/eluser]
Do you create the file in windows?
I'd got the same problem, if you have no linux OS, try to copy from someone or copy mine
http://upload.ugm.ac.id/673.htaccess

put it in the same directory with index.php (as the front controller of your project) and edit it as your need
#3

[eluser]bretticus[/eluser]
Quote:Each time I add the .htaccess file, no pages will load.

You get a 404? You get a server error?

It's possible .htaccess is not allowed on your server or mod_rewrite is just not available. Check by looking over your information from phpinfo(). Note that if your server is using CGI, you won't be able to know for sure from the results of phpinfo().

Use this guide to help you to find out.
#4

[eluser]mmcglynn[/eluser]
joedy - file created on a Mac in plain text

bretticus - I get a 500 Internal Server Error. mod_rewrite is enabled on my server.
#5

[eluser]Djordje Zeljic[/eluser]
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

try this code.
#6

[eluser]bretticus[/eluser]
[quote author="mmcglynn" date="1286559202"]I get a 500 Internal Server Error. mod_rewrite is enabled on my server.[/quote]

With a server error I'm not quite so sure. Do you get a server error with a blank .htaccess file?
#7

[eluser]mmcglynn[/eluser]
Djordje Zeljic - Yes, I wil try that.

bretticus - Not sure, I will try that as well.

My host claims that a Apache restart is not necessary. I have been doing this stuff on my live site, I will start doing test on a less domain so that I can let the file sit longer.




Theme © iAndrew 2016 - Forum software by © MyBB