0

This is my Virtual Host:

<VirtualHost *:8080>
   ServerAdmin webmaster@dummy-host.localhost:8080
   DocumentRoot "D:/test/testpage/"
   ServerName testpage
   ServerAlias testpage.localhost
   ErrorLog "logs/testpage-error.log"
   CustomLog "logs/testpage-access.log" common
</VirtualHost>

system/host

 127.0.0.1  testpage.localhost

httpd.conf in xampp/apache/conf/

Listen 8080
ServerName localhost:8080

LoadModule rewrite_module modules/mod_rewrite.so

<Directory />
   AllowOverride All
   Require all granted
</Directory>

my .htaccess file inside testpage folder

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

and in my application/config/config.php

$config['base_url'] = 'http://testpage.localhost:8080';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

the only issue am facing is that index.php, i can access my other pages but it have index.php between base_url() and view.

Jacken
  • 1
  • 2

1 Answers1

0

I suggest trying the following VirtualHost (vhost) directives.

It defines D:/test/testpage/testpage as the pubic root of the site. Both .htaccess and CodeIgniter's index.php should be in this directory. I've removed the ServerAlias - you don't need it. I've added explicit directives for the vhost directory

<VirtualHost *:8080>
   ServerAdmin webmaster@dummy-host.localhost:8080
   DocumentRoot D:/test/testpage
   ServerName testpage
   ErrorLog "logs/testpage-error.log"
   CustomLog "logs/testpage-access.log" common

   <Directory D:/test/testpage>
      Options -Indexes +FollowSymLinks
      AllowOverride All
      Require all granted
   </Directory>
</VirtualHost>

system/host should be

127.0.0.1  testpage

Because you have named the virtual host "testpage" the following should work.

$config['base_url'] = 'http://testpage/';
DFriend
  • 8,869
  • 1
  • 13
  • 26
  • Thanks for giving a solution, i've just want to remove the index.php and i've read an htaccess tutorial http://phptutorialandscripts.blogspot.com/2013/03/htaccess-file-tutorial.html in the BASICS and it solved my problem(last two words of the first paragraph). – Jacken Jun 01 '18 at 07:26