We are using friendly URLs, with an .htaccess file as follows:
# MODx supports friendly URLs via this .htaccess file. In order to use it, you must change the
# file name from ht.access to .htaccess. If you don't want to use friendly URLs, you can comment
# the three Rewrite directives out with pound signs (like the beginning of this line).
#
# Make sure RewriteBase points to the directory where you installed MODx.
# E.g., "/" if your installation is in your root web documents directory (it comes this way by
# default) or "/MODx" if your installation is in a MODx subdirectory, per the comments below. You
# must serve web pages via Apache with mod_rewrite to be able to use this functionality.
#
# The last two blocks of rules at the bottom of this .htaccess file address anamolies with IE
# for Windows PCs and the way in which it caches images, which causes a distracting flicker in
# background images when links are hovered on the page.
#
# The output compression directives immediately below serve to speed up delivery of web pages,
# and may also be optionally commented out.
#php_flag zlib.output_compression On
#php_value zlib.output_compression_level 5
# Rewrite directives here for SEF (Search Engine Friendly) URLs
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# If your MODx installation is in a subdirectory, change the following line to match the physical
# path to the "root" of the site as follows:
# RewriteRule ^(.*)$ /path/to/subdirectory/index.php?q=$1 [L,QSA]
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
# This following two sections stops screen flicker in IE on rollovers (Bad IE Win, Bad!).
# Comment these sections out if you do not need them. They can result in having to force reload
# pages when developing sites and changing images frequently to see your changes.
#ExpiresActive On
#ExpiresByType image/gif A2592000
#ExpiresByType image/jpeg A2592000
#ExpiresByType image/png A2592000
#BrowserMatch "MSIE" brokenvary=1
#BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
#BrowserMatch "Opera" !brokenvary
#SetEnvIf brokenvary 1 force-no-vary
Some of our URLs have changed, and I need to include a 301 redirect pointing to the new pages for the search engines. Including a line such as
redirect 301 /oldfilename http://www.domain.com/newfilename
returns a url as follows
http://www.domain.com/newfilename?q=oldfilename
which corresponds to the rewrite rule in the .htaccess file. I’ve done some looking but haven’t been able to find out how to get around this in the documentation or the forums. Any suggestions?
Thanks a lot,
Aaron