Forum Moderators: phranque
I'm trying to show
http://www.example.com/General/index.php?Akron
at
http://www.example.com/Akron/index.htm
Thanks in advance!
[edited by: tedster at 4:15 am (utc) on Nov. 30, 2008]
[edit reason] no specific urls, please - use example.com [/edit]
However note that your example code has
/General/index.ph[b]p?school=[/b]$1 in it, but your example server filepath has only /General/index.ph[b]p?[/b]Akron in it. In order for the code to work, the links on your page need to use the new (without parameters) format.
Mod_Rewrite does not alter URLs. It takes an incoming URL request and uses the rule to fetch the content from a place on the server that is different to the place that the URL might have suggested that it is located at. The request is generated by clicking a link on a page. That page has to show the URL that you want the user to see.
In general it is a bad idea to include index.html in a URL. The canonical form is without that included.
I would go further and go extensionless as well as ensuring the URL is entirely in lower-case.
e.g. www.example.com/akron
You need to ensure that requests for robots.txt, images, stylesheet and JS files, SE verification files, and so on are *not* captured by the rewrite.
Ahead of your rewrite you need a non-www to www 301 redirect so that your site doesn't serve content at both URLs.
Additionally, direct requests for the old URL should ideally redirect to the new URL so that the old URL does not get indexed by search engines.
your RewriteRule includes a school= parameter and your example url doesn't, so there's an apparent inconsistency there.
http://www.example.com/General/index.php?school=Akron
That is what I was trying to pull from. I got it to work for just http://www.example.com/Akron/, but I still can't get it to work for http://www.example.com/Akron/index.htm.
[edited by: tedster at 4:16 am (utc) on Nov. 30, 2008]
RewriteRule ^([A-Za-z]+)/(index\.htm)?$ /General/index.php?school=$1 [L]
Jim