logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: htaccess redirect with RewriteCond
Author
fi ku



Joined: 31 Mar 2016
Posts: 3
Location: World

PostPosted: Thu 31 Mar '16 13:57    Post subject: htaccess redirect with RewriteCond Reply with quote

I've this redirect to organize:

Code:
oldpage: http:// example.com/folder/public.php?service=files&t=7a406ad94e3e5b4f6ed247c6a279570a


Code:
newpage: http:// example.com/folder/public.php?service=files&t=1cb5f1a52ccebfebdb218ecbdb70f9e4


A the beginning I tryed with normal Redirect command in htaccess but I understood its not working because there is some value after .php in the url string, so I found this code using the ReWriteCond:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST}  ^example.com$ [NC]
RewriteCond %{QUERY_STRING}  ^service=files&t=7a406ad94e6e5b4f6ed246c6a279570a(&.*)?$ [NC]
RewriteRule ^folder/public\.php$ http:// example.com/folder/public.php?service=files&t=1cb5f1a52ccebfebdb218ecbdb70f9e4 [R=301,NE,NC,L]


But also is not working (whith the oldpage I recived a 404)... What is wrong?

Thanks in advance
Back to top
fi ku



Joined: 31 Mar 2016
Posts: 3
Location: World

PostPosted: Sun 03 Apr '16 11:14    Post subject: Reply with quote

^ up

no one know how to fix?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 04 Apr '16 12:10    Post subject: Reply with quote

There is a tutorial online https://wiki.apache.org/httpd/RewriteQueryString

if you still have a question please ask again.
Back to top
fi ku



Joined: 31 Mar 2016
Posts: 3
Location: World

PostPosted: Mon 04 Apr '16 15:16    Post subject: Reply with quote

Yes I need help, following your guide I tryed also with:

Code:

RewriteCond %{QUERY_STRING}  ^service=files&t=7a406ad94e6e5b4f6ed246c6a279570a$
RewriteRule (.*)  http:// example.com/folder/public.php?service=files&t=1cb5f1a52ccebfebdb218ecbdb70f9e4  [R=301,L]


But also is not working at all Crying or Very sad
Back to top


Reply to topic   Topic: htaccess redirect with RewriteCond View previous topic :: View next topic
Post new topic   Forum Index -> Apache