My domain originally had a www (https://www.my-domain.com) i changed it recently to redirect to non www.
Now when i go to my-domain.com on my browser, it goes to my localhost XAMPP dashboard (https://localhost/dashboard/). and when i turn xampp off, i get a "Unable to connect" on firefox.
I've tried the site on my mobile and my mac, it works fine and points to the server. I've also reinstall xampp on my PC, and still get the same result.
Not sure if this is the issue, but my current .htaccess is
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
</IfModule>
and my virtual host on my ubuntu server is
<IfModule mod_ssl.c>
<VirtualHost *:433>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/frontend/www
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName my-domain.com
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias www.my-domain.com
SSLCertificateFile /etc/letsencrypt/live/my-domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/my-domain.com/privkey.pem
</VirtualHost>
<Directory /var/www/html/frontend/www>
Options Indexes FollowSymLinks MultiViews
AllowOvereride All
Order allow,deny
allow from all
Require all granted
</Directory>
</IfModule>
Any idea what's going on?
My server is running ubuntu 18 on AWS.
The usual problem here is that you have no matching virtualhost set up to handle your new servername.
When that happens on a server, it "redirects" you to first matching virtualhost (which is probably xampp dashboard).
You have probably changed the application and it's .htaccess, but you didn't modify your virtualhost for the domain.
if you DID modify yourvirtualhost, please make sure to restart xampp, otherwise xampp won't consider changes made.
Related
I'm trying to deploy a Laravel 5.6 app on a Debian 9 based VPS with Apache, but the server seem to be unable to handle the requests when i try to access the first page,and i keep having
"Internal Server Error The server encountered an internal error or
misconfiguration and was unable to complete your request."
I've already looked at this
Laravel htaccess
Getting a 500 Internal Server Error on Laravel 5+ Ubuntu 14.04
https://www.howtoforge.com/tutorial/install-laravel-on-ubuntu-for-apache/
My .htaccess file that i placed inside the public folder
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
The configuration file places inside /etc/apache/sites-available
<VirtualHost *:80>
ServerName picodem.dev
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/picodem-project/public
<Directory /var/www/html/picodem-project>
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I don't have a domain name yet, and the picodem.dev is just dummy, so i'm accessing the app via the Browser using the IP address of the VPS, but i'm still not sure what's causing the problem...
I am new to laravel and trying to learn laravel but I am stuck while
entering a server name in httpd-vhosts.conf I entered this in httpd-vhost.contf:
<VirtualHost *:80>
DocumentRoot "D:/Xampp/htdocs/"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/Xampp/htdocs/lsapp/public"
ServerName lsapp.dev
</VirtualHost>
and in system32 host file :
127.0.0.1 localhost
127.0.0.1 lsapp.dev
See the error in homepage
Use run this command, in project root
php artisan serve --host=lsapp.dev --port=80
Be sure to stop mysql from xampp , which uses port 80,
Above command require to set 127.0.0.1 lsapp.dev in your host file, as you did already
If you want to go without command set DocumentRoot in httpd-vhost.contf as you did already
"D:/Xampp/htdocs/lsapp/public"
ServerName lsapp.dev
And in host file
127.0.0.1 lsapp.dev
And restart apache, stop and then start apache to reflect, and hit lsapp.dev browser
<VirtualHost lsapp.dev:80>
DocumentRoot "D:/Xampp/htdocs/lsapp/public"
ServerAdmin laravel.dev
<Directory "D:/Xampp/htdocs/lsapp/">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
and don't forget the .htaccess file in public folder
Apache (from laravel docu...)
The framework ships with a public/.htaccess file that is used to allow URLs without index.php. If you use Apache to serve your Laravel application, be sure to enable the mod_rewrite module.
If the .htaccess file that ships with Laravel does not work with your Apache installation, try this one:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
If your web host doesn't allow the FollowSymlinks option, try replacing it with Options +SymLinksIfOwnerMatch.
I am trying to make a virtual host for a codeigniter project. I have done this in httpd-vhosts.conf:
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\CI_projects\facebook-login"
ServerName dev.facebook-login.com
<Directory "C:\xampp\htdocs\CI_projects\facebook-login">
Require all granted
</Directory>
</VirtualHost>
and in application/config/config.php,
$config['base_url'] = 'http://dev.facebook-login.com';
and
$config['index_page'] = '';
the browser opens the landing page. but when transiting from any other uri it says object not found.
And when i configure httpd-vhosts.conf like this:
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\CI_projects\facebook-login\index.php"
ServerName dev.facebook-login.com
<Directory "C:\xampp\htdocs\CI_projects\facebook-login\index.php">
Require all granted
</Directory>
</VirtualHost>
It arises problem with assets things, i,e images and some css doesnt loads. How can I solve it?
I am on windows 10 and I use xampp with virtual host this is way I set up.
Put forward slash at end of base url
$config['base_url'] = 'http://dev.facebook-login.com/';
First go to
Windows > System32 > drivers > etc > host
You may need to open as administrator to be able to save it
You might see some thing like
127.0.0.1 localhost
Below that create another one for dev.facebook-login.com like example:
127.0.0.1 localhost
127.0.0.1 dev.facebook-login.com
Save it
Then go to the
xampp > apache > conf > extra > httpd-vhosts.conf
open it as administrator so you can save it.
No need for the index.php on DocumentRoot
<VirtualHost *:80>
##ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "C:/xampp/htdocs/CI_projects/facebook-login"
ServerName dev.facebook-login.com
##ServerAlias www.dummy-host.example.com
##ErrorLog "logs/dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
Save it and restart the severs.
I use this for my htaccess
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
httpd-vhosts.conf
Listen 1122
<VirtualHost *:1122>
DocumentRoot "D:\laragon_server\www\hugpong_production"
<Directory "D:\laragon_server\www\hugpong_production">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
https://www.namecheap.com/support/knowledgebase/article.aspx/10026/33/installing-an-ssl-certificate-on-xampp/
php 8 is not ready for CI4 as of jan 2021!
XAMPP has preloaded ssl certificate in php 7 packages
consider uncommon vhosts extra and place this in it
my only persistent issues is codeigniter 4 routes, have to turn on php spark serve to get XAMPP to route pages outside of default index, nothing else works, its garbage to that extent, will try with composer next....a whole book needs
to be wrote about codeigniter 4 routes and why they don't work, 200 pages plus
<VirtualHost localhost *:80>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
<VirtualHost example.com *:8080>
ServerName example.com
ServerAlias www.example.com
DocumentRoot "C:\xampp\htdocs\codeignite4\public"
//my project folder is codeignite4 without using composer this time
//i added listen 8080 under listen 80 in htppd.conf
ServerName example.com
<VirtualHost truservex.com *:443>
DocumentRoot "C:\xampp\htdocs\codeignite4\public"
ServerName example.com
SSLEngine On
SSLCertificateFile "C:/xampp/apache/conf/ssl.crt/server.crt"
// you can verifiy these file locations, certificate data
SSLCertificateKeyFile "C:/xampp/apache/conf/ssl.key/server.key"
// going without the Directory tag can be helpful to drop in vhosts
<Directory "C:\xampp\htdocs\codeignite4\public">
Require all granted
doing this i was able to replicate the original install, create site access
using http://localhost:8080 or http://example.com/ as my base url
in my example index.php is removed, set to ''
when using command prompt to get into codeignite4 project folder i can
launch php spark serve and routes will work that were previously 404
Using Xampp 7.3.25 Dec 2020 because php 8 will not run error
free with codeigniter 4 as of this date, this worked for me as
my first codeigniter 4 virtual host setup, my install had
difficulty initially with using port 80, seems to want to for
port 443 if it can..I'm not a server pro but i wanted to
leave this for the next guy....This is strictly name based
virtual hosts for develop, ip based would have obvious
advantages. Because i had trouble in initial CI4 testing with
port 80 the (*) in virtual hosts vs (*:80) seemed to solve one
hurdle in searching for more ports, now i can finally begin my
first project ...my default URL was also changed to example.com
in appstarter/apps/config file. Carefully reread <tags> for
typos, its easy to shut server down!
<VirtualHost *>
DocumentRoot "C:/Xampp/htdocs/"
ServerName localhost
<Directory "C:/Xampp/htdocs/">
Require all granted
<VirtualHost *>
DocumentRoot "C:/Xampp/htdocs/appstarter/public/"
ServerName example.com
ServerAlias www.example.com
# maybe don't attempt to use dir tag, shuts down server
# the directives at httpd.conf appear to suffice
I have added a htaccess file in the appstarter/public
I assume this is primitive, can get far more advanced
The Apache help pages helped me focus a bit more on
what i must accomplish, name based virtual hosts this case
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
2.2 Apache configuration: :Apache server context important!
Order allow,deny :The hackers are winning.....
Allow from all
2.4 Apache configuration:
Require all granted
i have been through lots of topic about this, and the thing is still not working so i was wondering if you could help me to see what i am doing wrong.
My goal is to have neat URL as www.name.com without the app.php nor web, and i have changed over and over my Virtualhost & Htacces that my page are kind of gone for now^^ (Yeah so pro)
So first, i have enabled the rewrite mod, and i am running a 2.2.2 apache version.
Here is my VirtualHost files :
<VirtualHost *:80>
ServerName steeph
ServerAlias name.com
DocumentRoot /home/ksc/www/symfony/web
<Directory /home/ksc/www/symfony/web>
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/project_error.log
CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>
I have also tried with line on :
<Directory "path">
DirectoryIndex app.php
Options -Indexes
AllowOverride All
Allow from All
</Directory>
which are not working either
For my htaccess i have tried at the symfony files root (and removing the /web from the virtual host) which was a fail, and i tried with this htaccess
<IfModule mod_rewrite.c>
RedirectMatch permanent ^/app\.php/(.*) /$1
RewriteEngine On
RewriteBase /web/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
I tried with the "RedirectMatch permanent ^/app.php/(.*) /$1" and without
So i have been to like a dozen of stackoverflows and i have tried even not popular answer but it still not working, so i would really appreciate some help here
Thanks a lot!
If Linux... enable Rewrite
sudo a2enmod rewrite
sudo service apache2 restart
You could just copy the one from symfony standard edition
-> https://github.com/symfony/symfony-standard/blob/master/web/.htaccess
and it would just work fine.
Probably this error has a pretty easy solution but I've been looking way to long at this and still don't get the error. I think I've tried whatever I could.
Problem: when I enable pretty permalinks on my wordpress installation (so, that it is using /%postname%/), it doesn't work. I get a 404 on all pages except for the homepage.
This page http://codex.wordpress.org/Permalinks tells me the requirements for permalinks to work:
Apache web server with the mod_rewrite module installed
In WordPress's home directory,
The FollowSymLinks option enabled
FileInfo directives allowed (e.g. AllowOverride FileInfo or AllowOverride All)
An .htaccess file (if this file is missing, WordPress will try to create it when you activate "pretty" permalinks)
If you want WordPress to update the .htaccess file automatically, WordPress will need write access to the file.
Apache web server has been installed, the mod_rewrite module has been loaded with a2enmod rewrite command (and the server has been restarted multiple times after). So, under /etc/apache2/mods-enabled, the symlink to rewrite.load is present. Also, when I run phpinfo command, I see that the mod_rewrite module has been loaded. You can check this as well here: http://namorti.com/phpinfo.php
Then, in /etc/apache2/sites-enabled, there was no "default" present. I copied 000-default.conf to default and edited default afterwards. It contains the following:
DocumentRoot /var/www
<Directory />
Options FollowSymLinks Indexes
AllowOverride FileInfo
</Directory>
So as far as I'm concerned, FollowSymLinks has been enabled and FileInfo directives are allowed.
As for the last two points, in my wordpress home directory (/var/www), .htaccess is present and writeable by Wordpress (I updated the permalink structure a couple of times and it updates the .htaccess file accordingly). Right now it contains the following:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
So, as far as I know, it SHOULD be working. I restarted the server (service apache2 restart) several times. I don't see what I'm missing. Anyone has a clue here?
Thanks in advance!
* EDIT *
So, I did what calcinai told me to do... I edited my /etc/apache2/sites-enabled/default file (containing the vhost). It now looks like this:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin www.namorti.com
DocumentRoot /var/www
<Directory /var/www>
Options MultiViews
AllowOverride None
Order allow,deny
allow from all
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
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>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
I've restarted apache again, but unfortunately it still doesn't work. Honestly it would have surprised me, because moving the directives from the .htaccess file to the vhost would work if the htaccess on itself would work, as everything else seemed correct enough to me...
Any other suggestions? Thanks for the effort!
Make sure the AllowOverrides directive is set to all in the vhost - that's what tells apache to look for .htaccess files in the webroot.
A better solution is actually to put your rewrite directives in the vhost, as you clearly have write access to the file. When you have AllowOverrides on, apache will look in the directory and all parent directories for .htaccess files on every request, which can be a big performance hit.
For Wordpress, your vhost should look something like:
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/site
<Directory /var/www/site>
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
allow from all
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</Directory>
</VirtualHost>
Solved it myself.
It had to do with the file "000-default.conf" - I copied it to "default" and edited "default", like I already mentioned in my question.
Apparently the service is using the file "000-default.conf" on itself. By copying the "default" file back to "000-default.conf" and restarting the apache service, everything works now.
One caveat: calcinai's suggestion seems like it should work, but with his suggestion in my vhost in the correct "000-default.conf" file, I got a 403 Forbidden error. When I replaced his content with my original content
DocumentRoot /var/www
<Directory />
Options FollowSymLinks Indexes
AllowOverride FileInfo
</Directory>
And then once again restarting the apache service, it all worked.
Thanks calcinai for your effort to try to help me :)
Permalink Problem
Inside of this file, we want to change all things.
sudo nano /etc/apache2/sites-available/000-default.conf
000-default.conf
- should look something like this:
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
If you dont see like this then paste the above code inside virtual host
When you are finished, save and close the file.
Next, we need to enable the rewrite module, which allows you to modify URLs. You can do this by typing:
sudo a2enmod rewrite
After you have made these changes, restart Apache:
sudo service apache2 restart
This may help you solve this:
sudo chown -R www-data:www-data /var/www
After spending really lots of time, here is what worked successfully in my Linux machine's LAMP server. Following changes are needed for me to make it work perfectly,
Add this to your /etc/hosts file.
127.0.0.1 sitename.com
Add host entry as follows in the path /etc/apache2/sites-available/sitename.com.conf
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName sitename.com
DocumentRoot /var/www/sitename.com/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/sitename.com/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Create symlink to sites-enabled.
sudo ln -s /etc/apache2/sites-available/sitename.com.conf /etc/apache2/sites-enabled/sitename.com.conf
Restart apache by using the command,
sudo service apache2 restart
This works perfectly for me. Instructions for adding host entry taken from, https://www.digitalocean.com/community/questions/wordpress-permalinks-not-working-on-ubuntu-14-04