homepage Welcome to WebmasterWorld Guest from 54.234.128.25
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Redirect Help
jo1ene




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

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.

 

jo1ene




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved