[SOLVED] Friendly URLs not working | Own Server with full control

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Config:
Silverstripe Version: 4.4, fresh install
Server-Config: Apache/2.4.41 (Unix) OpenSSL/1.1.1d PHP/7.3.10
mod_rewrite is enabled and shown by DUMP_MODULES

Friendly URls are not working. I am able to see the landing page of my fresh install, but when I try to switch e.g. to /about-us/ I get an “Object not found! The requested URL was not found on this server…”

Any help is very welcome.
Thanks, _fuz

This is my virtual host definition:
<VirtualHost 127.0.0.1:80>

ServerName mb-2019.intranet.domain.tld
ServerAlias mb-2019
ServerAdmin webmaster@localhost

DocumentRoot /srv/http/mb-2019.intranet.domain.tld/mb-2019/public/ 
<Directory /srv/http/minibagger.intranet.domain.tld/mb-2019/public/>
	Options Indexes FollowSymLinks MultiViews
	AllowOverride All
	Order allow,deny
	allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/mb-2019.error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/mb-2019.access.log combined

This is my public/.htaccess (generated by the installer, I guess)

### SILVERSTRIPE START ###
# Deny access to templates (but allow from localhost)
<Files *.ss>
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
</Files>

# Deny access to IIS configuration
<Files web.config>
    Order deny,allow
    Deny from all
</Files>

# Deny access to YAML configuration files which might include sensitive information
<Files ~ "\.ya?ml$">
    Order allow,deny
    Deny from all
</Files>

# Route errors to static pages automatically generated by SilverStripe
ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html

<IfModule mod_rewrite.c>

    # Turn off index.php handling requests to the homepage fixes issue in apache >=2.4
    <IfModule mod_dir.c>
        DirectoryIndex disabled
        DirectorySlash On
    </IfModule>

    SetEnv HTTP_MOD_REWRITE On
    RewriteEngine On
    RewriteBase '/'

    

    # Deny access to potentially sensitive files and folders
    RewriteRule ^vendor(/|$) - [F,L,NC]
    RewriteRule ^\.env - [F,L,NC]
    RewriteRule silverstripe-cache(/|$) - [F,L,NC]
    RewriteRule composer\.(json|lock) - [F,L,NC]
    RewriteRule (error|silverstripe|debug)\.log - [F,L,NC]

    # Process through SilverStripe if no file with the requested name exists.
    # Pass through the original path as a query parameter, and retain the existing parameters.
    # Try finding framework in the vendor folder first
    RewriteCond %{REQUEST_URI} ^(.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    # RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
    RewriteRule .* index.php
</IfModule>
### SILVERSTRIPE END ###

You have a different path for the DocumentRoot and the Directory directive in your virtual host config. Was that intentional?

Thank you so much, you are so right!
I was to blind to see.

1 Like