Results 1 to 12 of 12
Thread: htaccess 301 redirect page
-
09-05-2010, 10:31 AM #1Web Hosting Master
- Join Date
- Mar 2006
- Posts
- 984
htaccess 301 redirect page
Hi,
I'm trying to redirect index.php to search.php?search_new_images=1 from htaccess instead of using header("Location: ...).
Now, I do have SEO implemented from search.php to read search.htm . Is there a way to redirect without affecting the SEO once we type the query ?
-
09-06-2010, 02:37 AM #2Newbie
- Join Date
- Sep 2010
- Posts
- 11
You can try by putting this in the .htaccess of the corresponding directory.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} index.php$
RewriteRule ^(.*)$ search.php$1 [R=301,L]
</IfModule>
-
09-06-2010, 05:31 AM #3Web Hosting Master
- Join Date
- Mar 2006
- Posts
- 984
Sorry. This code shows the real unix path from query and index.phpsearch.php are sticked together. Any other solutions ... ?
-
09-06-2010, 07:31 AM #4Web Hosting Master
- Join Date
- Mar 2006
- Posts
- 984
This issue has now been resolved by Googling a little bit more.
-
09-06-2010, 07:53 AM #5WHT Addict
- Join Date
- Aug 2010
- Location
- Brussels, Belgium
- Posts
- 162
RewriteRule ^(.*)$ /search.php$1 [R=301,L]
will solve the problem of the Linux path (mind the added slash).
Jean-Luc
-
09-06-2010, 11:58 AM #6Junior Guru Wannabe
- Join Date
- Aug 2008
- Location
- In the shell...
- Posts
- 90
Try using this code for htaccess redirect
Hello Horizon,
Try using this code for htaccess redirect.Please add the destination URL.
Code:Redirect index.php http://destination URL
-
09-06-2010, 09:31 PM #7Web Hosting Master
- Join Date
- Mar 2006
- Posts
- 984
Since I already confirmed the first time that all is working, I thank both of you for helping me so far.
However, I do have another question. Is there a way to replace %26 and %20 into their appropriate characters from URL by using htaccess ?
-
09-07-2010, 01:01 AM #8WHT Addict
- Join Date
- Aug 2010
- Location
- Brussels, Belgium
- Posts
- 162
You should replace these codes by the characters they replace: replace %20 by a space character and replace %26 by &.
Use double quotes around the part including the space character. Example:
Code:redirect 301 "/space included/" http://www.example.com/
Jean-Luc
-
09-07-2010, 05:42 AM #9Newbie
- Join Date
- Sep 2010
- Posts
- 11
Yes adding the slash before the search.php should solve the problem.
-
09-07-2010, 07:29 AM #10Web Hosting Master
- Join Date
- Mar 2006
- Posts
- 984
-
09-07-2010, 07:42 AM #11WHT Addict
- Join Date
- Aug 2010
- Location
- Brussels, Belgium
- Posts
- 162
Example 1
If you want to redirect a directory named /bla%20blabla/, you cannot useCode:redirect 301 /bla%20blabla/ http://www.example.com/
Code:redirect 301 "/bla blabla/" http://www.example.com/
If you use regular expressions, you cannot useCode:RewriteRule ^bla%20blablabla/(.*)$ more.php/$1 [R=301,L]
Code:RewriteRule ^bla\sblablabla/(.*)$ more.php/$1 [R=301,L]
Jean-Luc
-
09-07-2010, 08:25 AM #12Web Hosting Master
- Join Date
- Mar 2006
- Posts
- 984
Similar Threads
-
301 htaccess redirect exeptions?
By lexington in forum Programming DiscussionReplies: 1Last Post: 06-29-2008, 08:20 AM -
301 redirect with .htaccess
By GreatDomainRace in forum Hosting Security and TechnologyReplies: 3Last Post: 07-12-2007, 09:23 PM -
Help with 301 Redirect in .htaccess plz ?
By Joel Theodore in forum Hosting Security and TechnologyReplies: 3Last Post: 02-27-2007, 06:53 PM -
htaccess redirect 301
By WebPhaser in forum Web Design and ContentReplies: 3Last Post: 12-30-2005, 02:37 PM -
301 redirect in htaccess question
By netcheap.com in forum Programming DiscussionReplies: 5Last Post: 07-06-2005, 04:43 PM