Forum Moderators: phranque
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]
/* from now on, code for other pages for example */
RewriteRule ^otherpage/([0-9]+)/([0-9]+)/$ other.php?some=$1&logout=$2 [L]
RewriteRule ^otherpage/([0-9]+)/$ other.php?play=$1 [L]
RewriteRule ^otherpage/ other.php [L] http://www.mysite.com/121/
[code]RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]
/* what I try and it doesn't works */
RewriteRule http://www.mysite.com/([0-9]+)/ index.php?logout=$1[L]
Note: Pattern matching in per-directory context
Never forget that Pattern is applied to a complete URL in per-server configuration files. However, in per-directory configuration files, the per-directory prefix (which always is the same for a specific directory) is automatically removed for the pattern matching and automatically added after the substitution has been done. This feature is essential for many sorts of rewriting - without this, you would always have to match the parent directory which is not always possible.
There is one exception: If a substitution string starts with ``http://'', then the directory prefix will not be added, and an external redirect or proxy throughput (if flag P is used) is forced!
RewriteRule ^([0-9]+)\/$ index.php?logout=$1 [L]