Welcome Guest, Not a member yet? Register   Sign In
will mod_rewrite work with temp urls???
#1

[eluser]charlie spider[/eluser]
i am doing a redesign for a small business's website
their existing hosting company charges WAY too much money
so we have set up an account with a new hosting company
i have built many CodeIgniter websites that are running on this same company's servers, and they all have the index.php removed with no problems.

we have not changed the DNS settings for this website yet, so the domain name still points to the old server.

the new website works fine on my localhost and i have uploaded it to the new server, but i can not get the htaccess file to work properly.

the server ( shared ip ) is set up as follows:

Code:
+ home   // our base folder
      + Code_Igniter_1.6.2   // removed from web root
      + public_html         // web root
            + application
            + images
            + javascript
            + stylesheets
            - .htaccess
            - index.php

i have set the following:

Code:
$config['index_page'] = "";
$config['uri_protocol']    = "AUTO";

and have tried both:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

and:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|javascript|style|favicon\.ico)
RewriteRule ^(.*)$ /index.php/$1 [L]

and have also tried the above with:
Code:
RewriteRule ^(.*)$ /public_html/index.php/$1 [L]

i also use base_url() when generating any links.

Now because the site has not had the DNS settings changed, to access the site on the new server i have to use an ip address that is like:

http://123.45.67.89/~directory/

and not simply: http://www.thesite.com

however, i can't get any pages to come up properly unless i explicitly add index.php to the url's

can mod_rewrite work when using a temporary url such as: http://123.45.67.89/~directory/

or do i just go ahead with changing the DNS and hoe that everything is working properly ?

anyone been in this situation before ?

any help is greatly appreciated.

Thanks
#2

[eluser]Phil Sturgeon[/eluser]
Not sure why the first set of rules failed, but the second set of rules can be easily fixed.

Quote:RewriteEngine on
RewriteCond $1 !^(index\.php|images|javascript|style|favicon\.ico)
RewriteRule ^(.*)$ index.php/$1 [L]

That will stop looking for your index file on the root of your domain. Now it will look for the index.php in the directory its currently looking at.
#3

[eluser]meigwilym[/eluser]
Have you tried it without the htaccess? (while remembering to change the index page in the $config)

CI does not work with my hosting unless I change $config['uri_protocol'] (like you did), but I was getting a CI error page (404? I can't remember properly). If you're seeing this then you're on the right track.

Mei
#4

[eluser]Pascal Kriete[/eluser]
The user directory might be an alias (as per this warning) - mod rewrite has a hard time with those. Try adding the passthrough ([PT]) flag to your RewriteRule:
Code:
RewriteRule ^(.*)$ index.php/$1 [PT, L]
#5

[eluser]charlie spider[/eluser]
[quote author="meigwilym" date="1222802755"]Have you tried it without the htaccess? (while remembering to change the index page in the $config)[/quote]

i have tried that and it does not work

what's weird is that i still have to manually add the index.php even after deleting the htaccess file and setting
Code:
$config['index_page'] = "index.php";

so does anybody know whether mod_rewrite will work with a temp url such as:

http://123.45.67.89/~somedir/

???

the DNS settings still point to the old server and i'm trying to get this working on a new server.

thanks for the help guys
#6

[eluser]charlie spider[/eluser]
so i deleted everything off of the new server then uploaded a fresh copy of CodeIgniter_1.6.3, configured database.php, and in config.php set:
Code:
$config['base_url'] = "http://123.45.67.89/~dirname/";
// temp url until DNS settings are changed to point at the new server

with no htaccess file.

the default system/application/views/welcome_message.php message came up properly.
everything working as expected.

then i went back into config.php and set:
Code:
$config['index_page'] = "";

then uploaded this htaccess file :
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|includes|javascript|style|uploads|favicon\.ico)
RewriteRule ^(.*)$ /index.php/$1 [L]

what happened next ???

404 Not Found

if i manually add index.php to the url then it of course works.



Now, since the temp url i have to use to access the server has a tilde in it like such:
http://123.45.67.89/~dirname/
would CI be filtering this out when it processes:
Code:
$config['base_url'] = "http://123.45.67.89/~dirname/";
???????????????

or is the fact that the DNS hasn't yet been changed over, somehow interfering with the htaccess file ????




Theme © iAndrew 2016 - Forum software by © MyBB