The frontend opens only the first page.

Installed Ubuntu 22 on a new test server according to the instructions
http://wiki.litecart.net/how_to_setup_debian_web_server_and_install_litecart

Admin is working fine.
But the frontend - the first page opens, and any other with an error:

[quote]Not Found
The requested URL was not found on this server.

Apache/2.4.52 (Ubuntu) Server at 10.211.55.26 Port 80[/quote]

Thanks in advance

tim

Welcome. :) Happy to hear you found good use of the wiki article. It is possible we forgot something when writing the wiki article.

This sounds like a problem with mod_rewrite or the path to document root.

What is the path to your app?

What is the path PHP shows in the variable $_SERVER['DOCUMENT_ROOT']?

What is the webpath to app set in .htaccess e.g. / or /subdirectory/?

Is Apache mod_redirect enabled?

Thank you for your response.
Sorry if it's too long:

Module rewrite already enabled```

```looka@bvsad2:/var/www/html$ ll
total 68
drwxr-xr-x 11 www-data www-data  4096 Jul 31 18:06 ./
drwxr-xr-x  3 root    root      4096 Jul 31 16:13 ../
drwxr-xr-x 24 www-data www-data  4096 Jul 31 16:25 admin/
drwxr-xr-x 18 www-data www-data  4096 Jul 31 18:23 cache/
drwxr-xr-x  2 www-data www-data  4096 Jul 31 16:25 data/
drwxr-xr-x  7 www-data www-data  4096 Jul 31 16:25 ext/
-rw-r--r--  1 www-data www-data  2724 Jul 31 18:04 .htaccess
drwxr-xr-x 10 www-data www-data  4096 Jul 31 18:04 images/
drwxr-xr-x 12 www-data www-data  4096 Jul 31 18:04 includes/
-rw-r--r--  1 www-data www-data 10671 Jul 31 16:24 index.html.0
-rw-r--r--  1 www-data www-data  1779 Jul 31 16:25 index.php
drwxr-xr-x  2 www-data www-data  4096 Jul 31 18:10 logs/
drwxr-xr-x  4 www-data www-data  4096 Jul 31 16:25 pages/
-rw-r--r--  1 www-data www-data  107 Jul 31 18:04 robots.txt
drwxr-xr-x  3 www-data www-data  4096 Jul 31 18:07 vmods/```

```looka@bvsad2:~$ php -r 'print_r($_SERVER);'
……….
[OLDPWD] => /etc/php/8.1/apache2
    [_] => /usr/bin/php
    [PHP_SELF] => Standard input code
    [SCRIPT_NAME] => Standard input code
    [SCRIPT_FILENAME] => 
    [PATH_TRANSLATED] => 
    [DOCUMENT_ROOT] => 
    [REQUEST_TIME_FLOAT] => 1690878131.905
    [REQUEST_TIME] => 1690878131
    [argv] => Array
…….```

```looka@bvsad2:/var/www/html$ cat  .htaccess
# Define some error documents
ErrorDocument 401 "Access Forbidden"
ErrorDocument 403 /error_document?code=403
ErrorDocument 404 /error_document?code=404
ErrorDocument 410 /error_document?code=410
ErrorDocument 500 "Internal Server Error"

# Deny showing indexes for directory content - Uncomment if supported by you web host
#Options -Indexes

# URL-rewriting
<IfModule mod_rewrite.c>
  RewriteEngine on

  # Tell PHP that the mod_rewrite module is enabled
  <IfModule mod_env.c>
    SetEnv MOD_REWRITE On
  </IfModule>

  # Force HTTPS (Standard SSL)
  #RewriteCond %{HTTPS} off
  #RewriteCond %{REQUEST_METHOD} !=POST
  #RewriteCond %{REQUEST_URI} !^/\.well-known/
  #RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

  # Force HTTPS (CloudFlare Flexi SSL / Load Balancing Servers)
  #RewriteCond %{HTTPS} off
  #RewriteCond %{HTTP:X-Forwarded-Proto} =http
  #RewriteCond %{REQUEST_METHOD} !=POST
  #RewriteCond %{REQUEST_URI} !^/\.well-known/
  #RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

  # Redirect non-www to www
  #RewriteCond %{HTTP_HOST} !^www\.
  #RewriteCond %{REQUEST_METHOD} !=POST
  #RewriteCond %{REQUEST_URI} !^/\.well-known/
  #RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

  # Redirect www to non-www
  #RewriteCond %{HTTP_HOST} ^www\.(.*)$
  #RewriteCond %{REQUEST_METHOD} !=POST
  #RewriteCond %{REQUEST_URI} !^/\.well-known/
  #RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]

  # Redirect from any alias domain to primary domain
  #RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
  #RewriteCond %{REQUEST_METHOD} !=POST
  #RewriteCond %{REQUEST_URI} !^/\.well-known/
  #RewriteRule ^ https://www.mydomain.com%{REQUEST_URI} [R=301,L]

  # Web path to catalog root
  RewriteBase /

  # No rewrite logic for physical files
  RewriteCond %{REQUEST_FILENAME} -d [OR]
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -l
  RewriteRule ^ - [L]

  RewriteRule ^ index.php [QSA,L]
</IfModule>

# Deny access to content
<FilesMatch "\.(htaccess|htpasswd|inc\.php)$">
  <IfModule mod_authz_core.c>
    Require all denied
  </IfModule>
  <IfModule !mod_authz_core.c>
    Order Deny,Allow
    Deny from all
  </IfModule>
</FilesMatch>

# Cacheable external content
<IfModule mod_headers.c>
  <FilesMatch "\.(css|js)$">
    Header set Cache-Control "max-age=86400, public, must-revalidate"
  </FilesMatch>

  <FilesMatch "\.(a?png|bmp|eot|gif|ico|jpe?g|jp2|js|otf|pdf|svg|tiff?|ttf|webp|woff2?)$">
    Header set Cache-Control "max-age=604800, public, must-revalidate"
  </FilesMatch>
</IfModule>

# GZip compress external content
<IfModule mod_deflate.c>
  <FilesMatch "\.(css|js|svg)$">
    SetOutputFilter DEFLATE
  </FilesMatch>
</IfModule>
tim

You would have to execute the print_r($_SERVER) command through the web interface to output $_SERVER['DOCUMENT_ROOT']. It is not set for PHP CLI as it is defined by the Apache process.

You can try defining DOCUMENT_ROOT as "/var/www/html" in includes/config.inc.php. That way we should quickly be able to deternine if this is a document root problem.

If this is not helping, is it possible that you can delegate access to FTP or SSH for me to find out what the cause of the problem is?

I created  file on server test1.php:


echo '<pre>';
print_r( $_SERVER );
echo '</pre>';```

And opened in browser:  http://10.211.55.26/test1.php
```Array
(
    [HTTP_HOST] => 10.211.55.26
    [HTTP_CONNECTION] => keep-alive
    [HTTP_PRAGMA] => no-cache
    [HTTP_CACHE_CONTROL] => no-cache
    [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
    [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
    [HTTP_ACCEPT_ENCODING] => gzip, deflate
    [HTTP_ACCEPT_LANGUAGE] => en,ru-RU;q=0.9,ru;q=0.8,en-US;q=0.7,sr;q=0.6
    [HTTP_COOKIE] => oc_sessionPassphrase=pbv92LGxXz96rCyhPVFaq%2FvY6Vdg5dn5VzBgDIEGW60iBxkOI%2FIFUbUWSjgWLN2mQ0VBTS%2BbUe9%2FpM7YcNatFjmkK4grmhOcqL7X%2Bqj2%2Fga8H8VIJlt%2BeQzKxZXs6sbu; nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; ocnvd4ry8z9k=mrno16kocdr4tglv1pqffon7fl; SL_G_WPT_TO=ru; SL_GWPT_Show_Hide_tmp=1; SL_wptGlobTipTmp=1; language_code=en; currency_code=EUR; cart[uid]=64c7f85c7e82f; LCSESSID=o118ob7h89j6uu01h319lmtqcb
    [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
    [SERVER_SIGNATURE] => 
Apache/2.4.52 (Ubuntu) Server at 10.211.55.26 Port 80

    [SERVER_SOFTWARE] => Apache/2.4.52 (Ubuntu)
    [SERVER_NAME] => 10.211.55.26
    [SERVER_ADDR] => 10.211.55.26
    [SERVER_PORT] => 80
    [REMOTE_ADDR] => 10.211.55.2
    [DOCUMENT_ROOT] => /var/www/html
    [REQUEST_SCHEME] => http
    [CONTEXT_PREFIX] => 
    [CONTEXT_DOCUMENT_ROOT] => /var/www/html
    [SERVER_ADMIN] => 6924094@gmail.com
    [SCRIPT_FILENAME] => /var/www/html/test1.php
    [REMOTE_PORT] => 63692
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => GET
    [QUERY_STRING] => 
    [REQUEST_URI] => /test1.php
    [SCRIPT_NAME] => /test1.php
    [PHP_SELF] => /test1.php
    [REQUEST_TIME_FLOAT] => 1690911568.2865
    [REQUEST_TIME] => 1690911568
)```
Is it right here? Or changes are required in includes/config.inc.php?

[quote]If this is not helping, is it possible that you can delegate access to FTP or SSH for me to find out what the cause of the problem is?[/quote]
Yes thank you! I will make access.
But later, the server is installed on the local network on the MacBook Pro + Parallels.......
It takes time to set up.
tim

Document Root looks to be set correctly from Apache. No need to modify config.inc.php.

Ok, a virtual machine I understand. It's enough if you can redirect a WAN port number to port 22 in the virtual machine. Send it to tim@litecart.net when ready. The easiest part of redirecting port is if the machine is part of the internal network (meaning it gets it's IP address from your router), and you do it from the router port mapping.

One thing you also can try is to force enable rewrite engine.

<IfModule mod_rewrite.c>  <-- removes this in .htaccess
</IfModule> <-- and the corresponding end of it

I have seen cases where IfModule was the problem.

redirect a WAN port number to port 22 in the virtual machine. Send it to tim@litecart.net when ready

Everything is set, please check your mail

Yes, I checked the work before the ssl certificate section and stopped.

Thank you for your prompt response and your help, it's much appreciated!

Big thanks!

This thread has been closed due to long inactivity. Posting to it is not possible.
View code on GitHub