2

Alright here is the situation: I use to have my codeigniter site at bluehost were I did not have root access, I have since moved that site to rackspace. I have not changed any of the PHP code yet there has been some unexpected behavior.

Unexpected Behavior:

http://mysite.com/robots.txt Both old and new resolve to the robots file

http://mysite.com/robots.txt/ The old bluehost setup resolves to my codeigniter 404 error page. The rackspace config resolves to: Not Found The requested URL /robots.txt/ was not found on this server.

**This instance leads me to believe that there could be a problem with my mod rewrites or lack there of. The first one produces the error correctly through php while it seems the second senario lets the server handle this error.

The next instance of this problem is even more troubling: 'http://mysite.com/search/term/9 x 1-1%2F2 white/'

New site results in: Bad Request Your browser sent a request that this server could not understand.

Old site results in: The actual page being loaded and the search term being unencoded.

I have to assume that this has something to do with the fact that when I went to the new server I went from root level htaccess file to httpd.conf file and virtual server default and default-ssl. Here they are:

Default file:

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName mysite.com
DocumentRoot /var/www
<Directory />
    Options +FollowSymLinks
    AllowOverride None
</Directory>

<Directory /var/www>
    Options -Indexes +FollowSymLinks -MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

    RewriteEngine On
    RewriteBase /

    # force no www. (also does the IP thing)
    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} !^mysite\.com [NC]
    RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L]

    # index.php remove any index.php parts
    RewriteCond %{THE_REQUEST} /index\.(php|html)
    RewriteRule (.*)index\.(php|html)(.*)$ /$1$3 [r=301,L]


RewriteCond $1 !^(index\.php|assets|robots\.txt|sitemap\.xml|favicon\.ico)
RewriteRule ^(.*)$ /index.php/$1 [L]
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

Default-ssl File Basically the same as the Default file above only used to handle ssl port

httpd.conf File Just a lot of stuff from html5 boiler plate, I will post it if need be

Old htaccess file

<IfModule mod_rewrite.c>

# index.php remove any index.php parts
RewriteCond %{THE_REQUEST} /index\.(php|html)
RewriteRule (.*)index\.(php|html)(.*)$ /$1$3 [r=301,L]

RewriteCond $1 !^(index\.php|assets|robots\.txt|sitemap\.xml|favicon\.ico)
RewriteRule ^(.*)/$ /$1 [r=301,L]

RewriteCond $1 !^(index\.php|assets|robots\.txt|sitemap\.xml|favicon\.ico)
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

This is the redirect responsible for directing every request to the index.php file to begin with...this is where i think the problem is (might have something to do with the directory? maybe something with my apache config?

RewriteCond $1 !^(index.php|assets|robots.txt|sitemap.xml|favicon.ico)

RewriteRule ^(.*)$ /index.php/$1 [L]

Any Help would be hugely appreciated!!

ngl5000
  • 45
  • 1
  • 8

0 Answers0