Use the previous 80 000 code examples in this forum for guidance.
lucy24
3:13 am on Nov 1, 2011 (gmt 0)
I would like the following URL change.
[domain.com...]
to be
[domain.com...]
Do you know what happened? Do you know how to prevent it? If not, you forgot to read the Forum Charter. The link doesn't exactly jump up & down and wave its arms for attention, but it is on this page.
kelsheikh
1:13 pm on Nov 1, 2011 (gmt 0)
I have tried this so far...
RewriteEngine On RewriteRule ^(.*)(.*).html$ city/index.php?st=$1&id=$2
also tried
RewriteEngine On RewriteRule ^(.*)(.*).html$ index.php?st=$1&id=$2
Which hasn't worked. I am putting this rule in an .htaccess into the city directory. Should I be putting this in root htaccess? Does it make a difference?
lucy24
11:15 pm on Nov 1, 2011 (gmt 0)
:: pause to run around screaming in horror because g1 is too grownup to indulge the desire to do the same ::
Q.: What's worse than a leading (.*) ? A.: Two leading (.*).
RewriteRule ^(.*)(.*).html$ index.php?st=$1&id=$2
It goes without saying that this rule does not do what is intended to do. So why don't you start by explaining in English what it is intended to do. Use www.example.com in your examples.
g1smd
12:19 am on Nov 2, 2011 (gmt 0)
The pattern (.*) means "everything".
So, the code (.*)(.*) means "everything" goes in $1, so what's left to go in $2?
I'm surprised you're not just seeing "500 Internal Server Error" here.
You need a better pattern. Additionally, literal periods in patterns must be escaped.
Add the [L] flag to every rule.
The rules you have shown in your post have "index.php" in them and are clearly some sort of rewrite.
In your question you asked for a redirect and there's no index.php in any of your examples.
In my root .htaccess I have tried the following but have found no success RewriteRule ^([a-z]{2})/(.*)\.html /city/index.php?st=$1&id=$2 [L] RewriteRule ^(.*)/(.*)\.html /city/index.php?st=$1&id=$2 [L]