logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


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

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: redirect when error 404 in single page web application
Author
manang



Joined: 11 Dec 2022
Posts: 1
Location: Switzerland

PostPosted: Sun 11 Dec '22 12:31    Post subject: redirect when error 404 in single page web application Reply with quote

Hi,
I'm trying to configure my apache server to avoid the flash 404 error (so, an initial error 404, but the webpage is shown).
The problem is that I need to redirect to a page with all the parameters to build the canonical url.

so, my input url has to be
https://myserver.com/auto/alfaromeo-giulietta

and after the error 404 has to be
https://myserver.com/auto/alfaromeo-giulietta

With the following configuration snippet in .htaccess is:
Code:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI}  ^/auto
RewriteRule (.*) /auto/ [QSA,L]


So, how can I pass the parameters to the final url?
Thanks a lot
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Mon 12 Dec '22 10:43    Post subject: Reply with quote

Without testing

Code:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/auto/(.*)$
RewriteRule ^(.*)$ /auto/$1 [QSA]
Back to top


Reply to topic   Topic: redirect when error 404 in single page web application View previous topic :: View next topic
Post new topic   Forum Index -> Apache