Forum Moderators: phranque
[edited by: wanttobe at 12:39 pm (utc) on Sep 26, 2011]
^([^.*])?$ supposed to mean? What it actually says is "match requests that do not contain a period or asterisk" and "match requests that are blank" (i.e. are for root).
What it actually says is "match requests that do not contain a period or asterisk" and "match requests that are blank" (i.e. are for root).
RewriteRule ^([^.*])?$ index.php?option=com_content&view=article&id=70&pid=1&toko=%2 [L,NC] Even better: It says "match requests that do not consist of a period or asterisk" (but may optionally consist of any other single character, though it would be hard to make it anything other than /) :)
RewriteRule ^([^.*])?$ index.php?option=com_content&view=article&id=70&pid=1&toko=%2 [L,NC]
Did you mean pid=$1 (using the text you captured in the first part of the Rule)? Where's id=70 coming from? Is the new query string intended to replace the old one, if any?
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC]
RewriteCond %1 !^(www|ftp|mail)$ [NC] www.subdomain.domain.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$ [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^.*$ index.php?option=com_content&view=article&id=73&Itemid=267&toko=%1 [R,L]
RewriteRule .
index.php?option=com_content&view=article&id=73&Itemid=267&toko=%1
[edited by: wanttobe at 7:15 am (utc) on Sep 30, 2011]
RewriteCond %1 <something> format is legal, and a neat way of making the comparison. It uses the capture from the previous condition. You can use $1 in the same way too. Nooooo! Get that [R] out of there! You're rewriting, not redirecting.Take care with ambiguous wording. For clarity "The code you presented is for an external redirect, you actually need an internal rewrite here." which could be read as meaning the exact opposite of what you wrote.
However with it there all requests are redirected to a new URL, and that URL still matches the (.*) pattern so the request is redirected again. It still matches the pattern and is redirected again in an infinite loop.
but if i change the script to
RewriteRule ^(.*)$ /toko-user?toko=%1 [L]
i got internal server error (500)
Note that mod_rewrite tries to guess whether you have specified a file-system path or a URL-path by checking to see if the first segment of the path exists at the root of the file-system. For example, if you specify a Substitution string of /www/file.html, then this will be treated as a URL-path unless a directory named www exists at the root or [typo for "of", I hope] your file-system, in which case it will be treated as a file-system path.