I have the following problem: as soon as I call up a file with additional parameters, the redirection does not work!
The forwarding is done with PHP header.
The file call in the browser:
https://www.mein_de_domain.de/archiv/Archiv-567KES.html,2021-01-04
The error message reads:
Multiple Choices
The document name you requested
(/archiv/Archiv-567KES.html,2021-01-04) could not be found on this
server. However, we found documents with names similar to the one you
requested. Available documents:
But the file is there!
Without parameter 2021-01-04, the call works perfectly.
Here are the contents of the file Archiv-567KES.html:
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: /archiv/Archiv-567KES.html" . ($_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : ''));
exit;
?>
Anyone have an idea why it works without parameters and not with parameters?
The additional characters ,2021-01-04 are not being regarded as a query string, but as part of the resource name (file name). If there is no file named Archiv-567KES.html,2021-01-04 that's why the web server can't find it.
Likely you mean the URL to be https://www.mein_de_domain.de/archiv/Archiv-567KES.html?2021-01-04 ? The question mark character marks the beginning of a query string. You do seem to have the question mark placed correctly in the header call in your script.
Is your webserver setup to use PHP when processing .html files? As Don R indicated above, this is why I suspect your server is returning that error.
As far as how you're passing the parameters, all of that is irrelevant until you can get your server to interpret files with the .html extension with PHP.
Look in yourhttpd.conf
you should see something that resembles the following:
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
That configuration is telling the server to use PHP to interpret files that end in a.php
extension.
Here's a quick article on what I think will help you get this solution working. Again, I'm not familiar with your specific environment, but that's the gist of what I think you're looking to accomplish.
Once you have the server interpreting .html files with PHP, then you can focus on properly passing the query string parameters.
first of all, thank you for all the replies to my post.
Well, I got the URL from our SEO department, exactly in this form.
Apparently, this URL came up in the evaluation of the data with the said message.
Regarding the parameter ,2021-01-04:
https://www.mein_de_domain.de/archiv/Archiv-567KES.html,2021-01-04
I will ask my colleagues again and give you feedback here.
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
HTML (English "hyper text markup language" - hypertext markup language) is a special markup language that is used to create sites on the Internet.
Browsers understand html perfectly and can interpret it in an understandable way. In general, any page on the site is html-code, which the browser translates into a user-friendly form. By the way, the code of any page is available to everyone.
https://www.w3.org/html/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.