Welcome to WebmasterWorld Guest from 54.158.228.55

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Redirect Help

     
9:59 pm on Mar 15, 2006 (gmt 0)

10+ Year Member



I posted this in the Drupal forums and nobody seems to have an answer (want to answer) there. So here's my problem:

We sent out an email blast with a link to a page. We just typed out the path. The email program dropped the last letter in the path so the link was incorrect. I wanted to use a redirect to compensate. The basic command is not working as expected for some unseen reason.

Basically I want this page http://example.com/foo-bar
to redirect to http://example.com/foo-bars

In .htaccess:

Rewrite /foo-bar http://example.com/foo-bars [R=301]

Instead I get http://example.com/foo-bar?q=foo-bars

The?q= being the Drupal default. I am using rewrite statements to get clean URLs:


RewriteEngine on
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

To get:
http://example.com/foo-bars rather than
http://example.com/?q=foo-bars

I just created a duplicate page to handle the immediate problem, but would like to know if anyone here has any bright ideas.

8:03 pm on Mar 16, 2006 (gmt 0)

10+ Year Member



RewriteRule ^foo-bar$ http://www.example.com/foo-bars [R=301,L]

I had to use Rewrite instead of Redirect and I had to put the statement before the other rewrite rules. I also had to use the L in the brackets.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month