Question

I am attempting to create an .htaccess file on an Apache server to implement 302 redirects. Hosting is provided by BlueHost.

Right now I am testing an .htaccess file which consists of just a single line:

Redirect http://mydomain.com/?_escaped_fragment_=about http://mydomain.com/about.html

The file doesn't work. After learning more, I created an httpd.conf file, which looks like this:

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Allow from all
</Directory>

One of the answers to this question (Apache 302 Redirect) suggests the following may be at issue:

  1. mod_alias is not loaded--how do I check whether it is or isn't?
  2. Adding the httpd.conf file may require an Apache restart. Is this possible on a shared BlueHost server?

Any advice on getting the 302 redirects to work is much appreciated. Thank you!

Was it helpful?

Solution

You can't match against the query string in a redirect, you'll need to use mod_rewrite:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=about$
RewriteRule ^$ /about.html [L,R=302]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top