logo
Apache Lounge
Webmasters

 


About

Forum Index Downloads Search Register Log in  RSS Apache Lounge
 


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.



Pretty URL's not working with HTTPS apache server

 
Post new topic   Reply to topic    Apache Forum Index -> Apache



View previous topic :: View next topic  
Author Message
webwizard



Joined: 17 Mar 2019
Posts: 1
Location: Denmark

PostPosted: Sun 17 Mar '19 12:50    Post subject: Pretty URL's not working with HTTPS apache server Reply with quote

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: 6531
Location: Germany, Next to Hamburg

PostPosted: Mon 18 Mar '19 14:36    Post subject: Reply with quote

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


Post new topic   Reply to topic    Apache Forum Index -> Apache
Page 1 of 1