E-Mail has been successfully sent.

Can I use the rewrite engine (mod_rewrite) for my PHP scripts?

The rewrite engine (mod_rewrite) can be used to automatically convert URLs.

mod_rewrite is installed in all current STRATO hosting packages and can be activated by you.

Activate mod_rewrite

It is sufficient to store an .htaccess file with the following entry in the root directory or in the desired directory of the webspace:

RewriteEngine on

This is followed by the individual RewriteRules, which you can determine yourself. Most applications (e.g. Typo3, Joomla or Wordpress) come with their own .htaccess. With these applications, it is usually sufficient to rename the .htaccess supplied or to activate it via the administration.

Please note that we cannot provide support for the individual programming of your content - this also includes the extensive topic of mod_rewrite or the individual RewriteRules.

We can only give you advice on how to activate mod_rewrite.

 

Example: replace desiredname.com with www.desiredname.com

mod_rewrite is an Apache module and is most commonly used to redirect URLs or to shorten extremely long URLs. Based on a parser (converter) for regular expressions, the requested URL can be manipulated. The aim here is usually to optimise the web pages for search engines.

A simple example of using mod_rewrite might look like this. The .htaccess contains the following content:

RewriteEngine on
RewriteCond %{http_host} ^desiredname.com [nc]
RewriteRule ^(.*)$ http://www.desiredname.com/$1 [r=301,nc]

With this simple redirect rule, all calls to the domain desiredname.com are redirected to www.desiredname.com. Background: Some search engines like it when the content of a domain is only accessible via one address.

Example: replace desiredname.com/index.html with desiredname.com/index.php

RewriteEngine on RewriteRule index.html$ index.php In the example, the domain is called up via http://www.desiredname.com/index.html forwarded to http://www.desiredname.com/index.php

Further information about mod_rewrite

The official documentation can be found at:
externer Link http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
More information:
externer Link http://httpd.apache.org/docs/2.2/misc/rewrite.html
externer Link https://en.wikipedia.org/wiki/Rewrite-Engine
externer Link https://modrewrite.de/
Note: Please note that we do not provide Directive RewriteOptions in .htaccess files and that the maximum depth for RewriteLoops is limited to 3.

The Apache directive RewriteOptions is not allowed.
Was this article helpful?
Info: 1251a6725973bcf6f6110c11c71150d67b8a821f