Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Pretty URL's not working with HTTPS apache server |
|
Author |
|
webwizard
Joined: 17 Mar 2019 Posts: 1 Location: Denmark
|
Posted: Sun 17 Mar '19 12:50 Post subject: Pretty URL's not working with HTTPS apache server |
|
|
I am trying to set up an Apache server on Ubuntu 18.04, I've managed to install everything and enabled HTTPS.
The problem is when I enter pretty URL's I get this message
Not Found
The requested URL /prettyurl was not found on this server.
Apache/2.4.29 (Ubuntu) Server at example.com Port 443
Config File
sudo nano /etc/apache2/sites-available/000-default.conf
Code: |
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
<Directory /var/www/html>
Options FollowSymLinks
AllowOverride all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.example.com [OR]
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI [END,NE,R=permanent]
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
.htaccess
Code: |
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ index.php?page=$1&c=$2&d=$3&e=$4 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ index.php?page=$1&c=$2&d=$3 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)$ index.php?page=$1&c=$2 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ index.php?page=$1 [NC,L]
|
WORKING URLS
https://example.com
https://www.example.com
https://www.example.com?page=prettyurls&id=1
http://example.com
http://www.example.com
http://example.com/prettyurls/1 (Pretty URL on HTTP working)
NOT WORKING
https://www.example.com/prettyurls/1 (Pretty URL on HTTPS NOT working)
https://example.com/prettyurls/1
I hope someone can help |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Mon 18 Mar '19 14:36 Post subject: |
|
|
There is a syntax error in your ssl vhost
after {REQUEST_URI the } is missing.
PLease run the syntax check or comment out that additional lines for testing. Don't forget to restart apache. |
|
Back to top |
|
|
|
|
|
|