Forum Moderators: phranque
Example
I am trying to eliminate the folder named "2009" from appearing in the URL. At the moment the path reads
http://www.example.com/news/2009/1048-boxing-2010.html
I am looking for it to read.
http://www.example.com/news/1048-boxing-2010.html
As I said I had this working weeks ago but missplaced the code, I have been trying the following Rewrite rule
#Check inf the file exists in /news/2009.
RewriteCond%{DOCUMENT_ROOT}/news/2009/$09 -f
RewriteRule ^[^/]+\.html$ /news/2009/$0 [QSA.L]
[edited by: jdMorgan at 2:53 pm (utc) on Jan. 25, 2010]
[edit reason] example.com [/edit]
# If the requested localized URL-path resolves to an existing file when "/news/2009"
# is prepended to it, rewrite the request to the /news/2009 subdirectory
RewriteCond %{DOCUMENT_ROOT}/news/2009/$1 -f
RewriteRule ^([^/]+\.html)$ /news/2009/$1 [QSA.L]
Jim