Pytanie ![]() |
Odpowiedź ![]() |
|||
---|---|---|---|---|
Włączenie rewrite
|
RewriteEngine On
|
|||
Forcing www in the URL (RewriteRule)
|
RewriteRule (.*) https://www.example.com/$1 [R=301, L]
|
|||
Forcing www in the URL (RewriteCond)
|
RewriteCond %{HTTP_HOST} ^example.com
|
|||
Input: user/NAME/ Output: user. php? id=NAME
|
RewriteRule ^user/(\w+)/?$ user. php? id=$1
|
|||
Optional trailing slash "/" in pattern
|
/?
|
|||
End of Input in pattern
|
$
|
|||
RewriteCond do jakiego RewriteRule
|
Wszystkie RewriteCond powyżej jednego RewriteRule muszą zostać spełnione
|
|||
Syntax of a RewriteRule
|
RewriteRule Pattern Substitution [Flags]
|
|||
Syntax of a RewriteCond
|
RewriteCond TestString Condition [Flags]]
|
|||
Pattern do wybrania wszystkich adresów
|
^(.*)$
|
|||
The [L] flag
|
indicates that this is the last rule to parse. Beyond this line, the rewrite engine should stop.
|