.htaccess rewrite rule to add a string in the middle of the URL
Posted
by Mike Crittenden
on Stack Overflow
See other posts from Stack Overflow
or by Mike Crittenden
Published on 2010-06-10T00:03:52Z
Indexed on
2010/06/10
0:12 UTC
Read the original article
Hit count: 879
Using a .htaccess rewrite rule, I need to add "?q=" before the path on any URL's containing the word "imagecache"
Therefore, if the URL is:
http://mysite.com/sites/default/files/imagecache/myimage.jpg
...then it will really try:
http://mysite.com/?q=sites/default/files/imagecache/myimage.jpg
But that will ONLY happen if the URL contains "imagecache." Otherwise, it does no rewriting.
Also, this will only happen if /sites/default/files/imagecache/myimage.jpg isn't already an existing image file. I believe I can do that using:
RewriteCond %{REQUEST_FILENAME} !-f
...right? It's just the first part that I can't figure out.
© Stack Overflow or respective owner