Foo.com/city/staticpage-cityname.html & # 8594; foo.com/staticpage-cityname.html
My current solution is to put everything in the root of the site, although it gives the desired result, it filled my root folder (over 200 cities). I would like to put all the cities in the / root / cities / folder and rewrite them to look like they are in the root folder.
www.foo.com/cities/citypage (.html) at www.foo.com/citypage(.html)
0
a source to share
1 answer
You can use a rule that checks if there is such a file in the folder cities
:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}cities%{REQUEST_URI} -f
RewriteRule !^cities/ cities%{REQUEST_URI} [L]
RewriteCond %{THE_REQUEST} ^GET\ /cities/([^\s?]*)
RewriteRule ^cities/ /%1 [L,R=301]
0
a source to share