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

[eluser]Lost_all_hope[/eluser]
I'm just getting to grips with CI, and spent a fair amount of time learning ZF but looking a CI this is more to what my requirements are, but having trouble dropping index.php out of the url, I've followed the instruction manual No Joy, Mod_Rewrite is set up and working correctly, it's working on other test projects.

Using VHOST in XAMPP I have the following:
<VirtualHost *:80>
##ServerAdmin [email protected]
DocumentRoot "C:\sites\ci"
ServerName ci
<Directory "C:\sites\ci ">
Order Deny,Allow
Allow from all
RewriteEngine On
RewriteBase /

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

RewriteRule ^(.*)$ index.php/$1 [L]
</Directory>
</VirtualHost>

HOST file


127.0.0.1 ci

Project Structure is as follows:
ci/
ci/system (this will be removed once live outside of the root of the site)
ci/index.php
ci/.htaccess (disabled at this point)
ci/user_guide (this will not be on the live site)

I've created a class of application/controllers/blog.php and view of application/views/blog_view.php and changed base_url in config.php to http://ci/

with the above setup I go to http://ci/blog/ it works, moving the Rewrite stuff to .httacess and removing the Rewrite stuff from the VHOST file, restarting Apache I get a 404 Object not found?? unless I use http://ci/index.php/blog/

I wish to put the Rewrite stuff in .htaccess file ready for when it goes live, as I don't have access to the VHOST file on the server, so getting .htaccess working in Development makes sense.

Anybody using XAMPP or a local server using VHOST who has had this issue and over come it could you please let me know how to get it working?

Thanks in advance

Mal
#2

[eluser]Jings[/eluser]
What about setting the RewriteBase to /ci/ like so:

Code:
<VirtualHost *:80>
  ##ServerAdmin [email protected]
  DocumentRoot “C:\sites\ci”
  ServerName ci
  <Directory “C:\sites\ci “>
    Order Deny,Allow
    Allow from all
    RewriteEngine On
      RewriteBase /ci/
    
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
  
      RewriteRule ^(.*)$ index.php/$1 [L]
  </Directory>
</VirtualHost>
#3

[eluser]Lost_all_hope[/eluser]
[quote author="Jings" date="1287508206"]What about setting the RewriteBase to /ci/ like so:

Code:
<VirtualHost *:80>
  ##ServerAdmin [email protected]
  DocumentRoot “C:\sites\ci”
  ServerName ci
  <Directory “C:\sites\ci “>
    Order Deny,Allow
    Allow from all
    RewriteEngine On
      RewriteBase /ci/
    
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
  
      RewriteRule ^(.*)$ index.php/$1 [L]
  </Directory>
</VirtualHost>
[/quote]

Hi this part works and dispays in the browser within VHOST file with or without RewriteBase /ci/

That's not my issue the issue is i want to transerfer the above values from C:\xampp\apache\conf\extra\httpd-vhosts.conf of:

RewriteEngine On
RewriteBase /ci/

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

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

To a C\sites\ci\.htaccess file at the root of the project
ci
ci/system
ci/index.php
ci/.htaccess

So when I put it on a live web site I only have access to .httacess file not the VHOST file, the problems is when I add the above values to the .htaccess file then remove the above code from the VHOST file, then I restart apache navigate to the url via a browser it says:

Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404
ci
19/10/2010 13:54:08
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1

basically my object is to move the code from httpd-vhosts.conf to the .htaccess file so I then can have URL's of http://ci/blog/ and not http://ci/index.php/blog/

I've tried various methods to get the .htaccess working on this project including a couple of suggestion of this forum with or without RewriteBase on without success.

Again heres the setup:

C:XAMPP
C:XAMPP|APACHE
httpd-vhosts.conf setup in Apache of the following:
## CodeIgnightor
<VirtualHost *:80>
##ServerAdmin [email protected]
DocumentRoot "C:\sites\ci"
ServerName ci
<Directory "C:\sites\ci ">
Order Deny,Allow
Allow from all
RewriteEngine On
RewriteBase /

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

RewriteRule ^(.*)$ index.php/$1 [L]
</Directory>
</VirtualHost>
LoadModule rewrite_module modules/mod_rewrite.so uncommented in httpd.conf

HOST file 127.0.0.1 ci

C:\sites\ci (root of site)
Site layout:
ci
ci|system
ci|index.php
ci|.htaccess (this is where I want my rewrite stuff to work from)

Any help appreciated

Cheers

Mal
#4

[eluser]Lost_all_hope[/eluser]
Sorted it

after digging further and put my glasses back on :-)

he's how it should be wrote to work with VHOST on XAMPP

httpd-vhosts.conf

## CodeIgnightor
<VirtualHost *:80>
##ServerAdmin [email protected]
DocumentRoot "C:\sites\ci"
ServerName ci
<Directory "C:\sites\ci ">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

.htaccess file (root of project)

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

Cheers

Mal
#5

[eluser]Frank Rocco[/eluser]
I am not using VHOST, just .htaccess

This works for me.

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

Also removed index.php from Config.php
#6

[eluser]Unknown[/eluser]
Hi i use this code:
Code:
httpd-vhosts.conf

## CodeIgnightor
<VirtualHost *:80>
  ##ServerAdmin [email protected]
  DocumentRoot “C:\sites\ci”
  ServerName ci
  <Directory “C:\sites\ci “>
          AllowOverride All
          Order allow,deny
      Allow from all
    </Directory>
</VirtualHost>

.htaccess file (root of project)

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

If I put http://ci/test, it redirects to http://ci/test/?/test.
Does anyone have any suggestions?




Theme © iAndrew 2016 - Forum software by © MyBB