VirtualHost port 8080. apache 2.4 . removing index.php in htaccess - php

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.

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/';

Related

what will be my .htaccess setting?

I currently using CodeIgniter 3. It is working on my laptop.
But when I upload it to my Centos 6.9 server... I encounter an error.
I already check the mod_rewrite is loaded.
I want it to be like this URL/controller/method (no index.php after URL)
It shows me a 404 when i try to login which redirect me to this URL/gate/login
I also set this....
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
My htaccess on /var/www/html/calllist
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /calllist/index.php?/$1 [L]
</IfModule>
My httpd.conf
DocumentRoot "/var/www/html"
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<VirtualHost *:80>
ServerAdmin webmaster#xxxx.com
DocumentRoot /var/www/html/calllist
ServerName www.xxxx.com
ErrorLog /var/www/html/calllist/error_log
CustomLog /var/www/html/calllist/requests.log common
</VirtualHost>
i solved the issue.
apparently on httpd.conf, there is another line i need to set to 'All'.
and i added this to my virtual host
<Directory "/var/www/html/calllist">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Laravel5 Ubuntu only working when myvirtualdomain/index.php/subsites

I'm using Ubuntu 14.04. I have installed LAMP, Composer and I installed Laravel. I created virtual domain (laravel.dev) and it works, but only when I'm using for simple laravel.dev/index.php/auth/login. When I use laravel.dev/css I have laravel/public/css folder. I have default .htaccess file:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
AllowOverride All
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
And my *.conf file:
<VirtualHost *:80>
ServerName laravel.dev
ServerAdmin webmaster#laravel.dev
DocumentRoot /var/www/laravel/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
How can I fix it?
My main page:
http://i.imgur.com/AxQjV9q.png
I fall this problem.I solved it using apache mod rewrite enable.For that follow this
http://www.kingpabel.com/apache-mod_rewrite/
Currently, your virtualhost doesn't allow overriding the rewriting settings in the .htaccess of your project.
You should add the following lines to your .conf file, in the virtualhost :
<Directory "/var/www/laravel/public">
AllowOverride All
</Directory>
Which would result in the following file :
<VirtualHost *:80>
ServerName laravel.dev
ServerAdmin webmaster#laravel.dev
DocumentRoot /var/www/laravel/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/laravel/public">
AllowOverride All
</Directory>
</VirtualHost>

Wordpress Permalinks Not Working On New Server

My server was recently compromised. I moved everything to a new server, but for some reason the permalinks for the Wordpress site are not working properly. I've looked everything over and it all appears to be correct, but I can't see why the links won't work when the settings were all copied over from the old server where they all worked.
Server .conf:
<VirtualHost *:80>
ServerName www.XXX.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/XXX.com/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
<VirtualHost *:80>
ServerAlias XXX.com
ServerAdmin XXX
DocumentRoot /var/www/html/XXX.com/
ServerName www.XXX.com
DirectoryIndex index.html index.php
<Directory "/var/www/html/www.XXX.com/">
allow from all
Options -Indexes
AllowOverride All
</Directory>
CustomLog ${APACHELOGDIR}/XXX.log common
ErrorLog ${APACHELOGDIR}/XXX-error.log
</VirtualHost>
.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUESTFILENAME} !-f
RewriteCond %{REQUESTFILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Make sure .htaccess has right permissions so that wordpress can change it on its own.

Apache and Yiiframework: two applications

I have two Yiiframework applications with this structure:
.framework
.site
.site2
But, if I try to open the site: www.mysite.com/site2 I receive 404 error of Yii( exception.CHttpException.404) saying that he didn't find the Controller called: site2
I already added a virtualhost of site2 on my apache:
<Virtualhost *:80>
ServerName www.mysite.com/site2
ServerAlias www.mysite.com/site2
ServerAdmin www#localhost
DocumentRoot "/home/server/public_html/site2/"
<Directory "/home/server/public_html/site2/">
Order allow,deny
Allow from All
AllowOverride All
</Directory>
</VirtualHost>
My .htaccess that it's inside of "site folder" (I redirect to https://):
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*) https://%{HTTP_HOST}/$1
I want that, when I open the site: www.mysite.com/site2 goes to my subdirectory /site2 and not /site. What I'm doing wrong?
Site 2 is not a site, but a subdirectory in the URL www.mysite.com/site2
The ServerName value is incorrect. You will have to another site name or a subdomain name
<Virtualhost *:80>
ServerName site2.mysite.com
ServerAdmin www#localhost
DocumentRoot "/home/server/public_html/site2/"
<Directory "/home/server/public_html/site2/">
Order allow,deny
Allow from All
AllowOverride All
</Directory>
</VirtualHost>
or
<Virtualhost *:80>
ServerName www.site2.com
ServerAdmin www#localhost
DocumentRoot "/home/server/public_html/site2/"
<Directory "/home/server/public_html/site2/">
Order allow,deny
Allow from All
AllowOverride All
</Directory>
</VirtualHost>

PHP Codeigniter - Apache virtual host setup trouble

This has been doing my head in. Hope you guys can help. I can't find out where the error lies.
httpd-vhosts.conf
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot /opt/lampp/htdocs
ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot /home/tilman/Sites/mysite/www
ServerName mysite.lo
</VirtualHost>
/etc/hosts
127.0.0.1 localhost
127.0.0.1 mysite.lo
config.php
$config['base_url'] = "http://mysite.lo";
$config['index_page'] = "";
www/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
Now http://mysite.lo shows me the default controller. http://mysite.lo/index.php as well. So does http://mysite.lo/index.php/welcome.
But http://mysite.lo/welcome doesn't.
http://localhost/mysite/www/welcome works as expected.
edit:
I want to move system and application out of the web root.
So my file structure looks like this:
application/
system/
www/
'- index.php
In index.php I changed the paths to system and application folder, of course.
Sounds like you're having rewritemod/htaccess issues rather than VirtualHost issues. Have you made sure that you've got a block such as
<VirtualHost *:80>
ServerName mysite.lo
<Directory /home/tilman/Sites/mysite>
AllowOverride All
</Directory>
</VirtualHost>
somewhere within your config files? The fact that /index.php and /index.php/welcome work, tell me that it's the rewrite mod that's not functioning...
In your virtual host, do you not need this?
<VirtualHost 127.0.0.1>
DocumentRoot /home/tilman/Sites/mysite
ServerName mysite.lo
</VirtualHost>
I'm not sure you needed the www portion.

Categories