w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to redirect to a URL getting from query parameter...?
Based on what you have mentioned you are doing correct, incase you want control to be send to other resource you use sendRedirect, if the resource sits on the same server you use forward. I would suggest reading more at following URL, it has some examples as well for both forward and redirect http://www.javapractices.com/topic/TopicAction.do?Id=181 Cheers !!

Categories : Java

.htaccess redirect to subdomain based on query string parameter
This will redirect all the URLs with QUERY_STRING like id=subdomain and file message.php to the appropriate subdomain: RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?example.com$ [NC] RewriteCond %{QUERY_STRING} ^id=(.*)$ RewriteRule message.php http://%1.example.com/message.php? [R=301,L] Mind the question mark at the end of message.php? - it is used to suppress appending the old QUERY_STRING. I added the domain name check to avoid the possibility of eternal redirect loop.

Categories : Htaccess

Quick Basic PLAY function parameter syntax. Example: PLAY "MSe8f#4f#8f#8g8a8b4.a4.g4.f#4.o0b8o1e8e8e4d8e2."
A quick google search brings up: http://en.wikibooks.org/wiki/QBasic/Appendix#PLAY You need to practice your Google-Fu! Looks like pretty standard musical notation too - dotted notes, sharps etc In the interests of making this answer make sense in case wikibooks explodes: Whitespaces are ignored inside the string expression. There are also codes that set the duration, octave and tempo. They are all case-insensitive. PLAY executes the commands or notes the order in which they appear in the string. Any indicators that change the properties are effective for the notes following that indicator. Ln Sets the duration (length) of the notes. The variable n does not indicate an actual duration amount but rather a note type; L1 - whole note, L2 - half note, L4 - quarter note, e

Categories : Misc

redirect user to play store from my app
Your copy of the Play Store does not support market://apps/collection/editors_choice. You might try the alternative (http://play.google.com/store/apps/collection/editors_choice) to see whether the Play Store comes up as an available option. If it does, then that would suggest a documentation bug, and there's some different syntax for the market:// version of that Uri. If the Play Store does not come up as an option, that would suggest that your edition of the Play Store perhaps pre-dates the addition of support for those Uri structures.

Categories : Android

How to implement a POST-REDIRECT-GET in Play Framework
That's the exact purpose of the Form objects (http://www.playframework.com/documentation/2.1.1/ScalaForms). And I think there is a an error in your routes, it could look like: GET /users/add controllers.Users.preInsert(...) POST /users/add controllers.Users.insert(...) You should definitively take a look at the form sample.

Categories : Scala

Http GET request parameter as query parameter and header
As per the convention, you should set the request parameter for GET request in the query string. Headers are used for passing message/meta information along with the request. So use headers to set that information only, such as Content-Type,Accept. Avoid mixing the headers and request params.

Categories : Java

play framework, redirect block users to some page
Add a isBanned property set to true for banned users and redirect accordingly. public class Application extends Controller { @Before static void preAction() { if(connectedUser().isBanned){ banned(); } } public static void banned() { String title = "You have been naughty"; render(title); } } And have all your controlled use the @With annotation @With(Application.class) public class MyControllerextends Controller {

Categories : Security

301 redirect URL with query string, removing part of the beginning URL, keeping the full query at the end
According to the documentation, the query string is passed through unchanged by default RewriteRule products/search.php http://www.site.com/products/ [L,R=301]

Categories : Htaccess

Play Framework - how do I redirect to a page generated by a plugin controller? [SecureSocial]
In order to show the message, you must have an item in the Flash. When you hit /login directly, there is no flash, so you won't see that message. If you want to see that message: Redirect(securesocial.controllers.LoginPage.login).flashing( ... )

Categories : Http

Play Framework not recognizing path parameter
Whoops...It looks like I was looking at documentation for a previous version of Play. The current documentation here shows that my routes file should look like this: GET /clients/:clientId controllers.Application.showClients(clientId : Long) Thanks to anyone who looked into finding an answer to the question.

Categories : Java

Redirect sub directory name as a parameter to other site
Try adding this to the htaccess file in your document root: RedirectMatch 301 ^/embed/([0-9]+) http://embed.cbplayer/player.swf?config=http://sub.site.com/cbplayer/embed_player.php?vid=$1 Or if you would rather use mod_rewrite: RewriteRule ^/?embed/([0-9]+) http://embed.cbplayer/player.swf?config=http://sub.site.com/cbplayer/embed_player.php?vid=$1 [L,R=301]

Categories : Htaccess

HTAcess 301 Redirect URL Parameter that has a Wildcard?
Try: RewriteCond %{HTTP_HOST} ^www.mydomain.com$ [NC] RewriteCond %{QUERY_STRING} ^view=([0-9]+)$ [NC] RewriteRule ^viewGallery.php$ http://www.mydomain.com/gallery/?view=%1 [R=301,NE,NC,L] This is essentially what you have except you change the regex for the query string to capture the ID, then you can backreference it using %1 in the rule's target. But, an easier way to do it is: RewriteCond %{HTTP_HOST} ^www.mydomain.com$ [NC] RewriteCond %{QUERY_STRING} ^view=([0-9]+)$ [NC] RewriteRule ^viewGallery.php$ http://www.mydomain.com/gallery/ [R=301,NE,NC,L] Simply remove the ?view=%1 part altogether. The rewrite engine will automatically append the query string to the end as long as you don't have a ? in the target.

Categories : Htaccess

redirect to a different JsonResult using string parameter
This is a verbose answer, but it should work: Dictionary<string, Func<JsonResult>> nameToMethodDict = new Dictionary<string, Func<string, JsonResult>>(){ {"name", otherMethod} }; public JsonResult GetBadgeValues(int badgeId, string actionName) { if (actionName != "none") { return actionName; } else { return nameToMethodDict[actionName](); } } public JsonResult otherMethod() { ... } I would reconsider this architecture, though, because if you want to return different data depending on some value in the database it really should be set-based logic in a stored procedure as opposed to this silly string->delegate relationship. If, on the other hand, you have only 5 or some countable number of possible actionName

Categories : Asp Net

.htaccess | no redirect if there is an specific parameter
From the Apache docs: REQUEST_URI The path component of the requested URI, such as "/index.html". This notably excludes the query string which is available as as its own variable named QUERY_STRING. So you are actually looking to match on %{QUERY_STRING} rather than %{REQUEST_URI}. Don't include the ? on the query string when matching its condition: RewriteEngine On # Match the absence of rewrite=no in the query string RewriteCond %{QUERY_STRING} !rewrite=no [NC] # Then rewrite .html into index.php RewriteRule .html index.php [L]

Categories : Htaccess

Routing in Java Play Framework 2, List<> as parameter
First of all, I think you need to put the package of your object in the [] of the list : List[path.of.your.package.Infoobject] (there are no imports in your routes). Anyway, I think you can only put String and Numerals in the URL, in order to send arguments to your controllers. 1rst workaround : You can create a QueryStringBindable that binds your object (List[Infoobject]) to a string, so that the information sent via URL as a String is recovered by your controller as a List[Infoobject]. 2nd workaround : Your can send Strings that could help you recreate the List in you controller (If you query the database for example, or if it's a List of object that only contains String attributes) Here is the java doc for the QueryStringBindable : http://www.playframework.com/documentation/api/2.1.

Categories : Java

cannot get xp_seller and bcp to play nice with stored procedure with parameter
This should work, note the pair of single-quotes around the stored procedure parameter: EXEC xp_cmdshell 'bcp "EXEC DatabaseName.dbo.pn_FlatProductXML ''KA-0009'' " queryout "C: est.txt" -T -c '

Categories : SQL

htaccess | mod_rewrite | redirect to URL domain parameter
And what about $1 in the rewrite rule? Does changing it to $0 fixes this? $1 to $9 provide access to the grouped parts (in parentheses) of the pattern, from the RewriteRule which is subject to the current set of RewriteCond conditions. $0 provides access to the whole string matched by that pattern. Apache mod_rewire doc

Categories : Htaccess

Redirect rewrite rule, Adding parameter at the end of url
Your rule is close, but you're not actually adding anything to the query string. Try: RewriteEngine On RewriteCond %{QUERY_STRING !&addpar1=val&addpar2=val RewriteRule ^/?c/(.*)$ /%1?%{QUERY_STRING}&&addpar1=val&addpar2=val [L] Here, you need to check that the parameters has already been added, then you add them to the end of the query string. You don't want the QSA flag here because you're manually doing the appending. If you want to redirect the browser so that they see the query strings then you need an R or R=301 flag in the square brackets (separated by a comma).

Categories : Apache

HTAccess Redirect using main parameter, ignore all others
It's not clear to me what your starting point is and where you're trying to end up. Do you have "pretty" URLs that you want to convert into "non-pretty" Query Strings that your scripts can actually digest? The reason for the redirection is that search-engines have indexed these pages and so I need to prettify the URLs. If the search engines have already indexed the Query String non-pretty version, they'll have to now re-index with pretty URLs. Ditto for all your customers' bookmarks. If you want to generate "pretty" links within your site, and decode them (in .htaccess) upon re-entry to non-pretty Query Strings, that should work. Your customers' existing bookmarks should even continue to work, while the search engines will replace the non-pretty with the pretty URLs.

Categories : Htaccess

.htaccess redirect by adding parameter if required
To do this you need to use a RewriteCond and the %{QUERY_STRING} before your RewriteRule. It seems that you don't want to Rewrite whenever the query contains the lang parameter therefore you could use a negative RewriteCond such as: RewriteCond %{QUERY_STRING} !(^|&)lang=1($|&) RewriteRule . /index.php [L] With the above, the RewriteCond would fail when the URL already had "lang=1" therefore do not apply the following RewriteRule (which in this arbitary example simply rewrites the request to /index.php but you can tailor that to your specific needs). Your actual rule may be different but the mechanics remain the same, use a RewriteCond and the %{QUERY_STRING}. Hope this helps.

Categories : Htaccess

codeigniter get last insert id from model to use as redirect parameter
You were very close. Instead of repeating $id = $this->db->insert_id(); in your controller, you can return the $cid from your models method. Model public function add() { $data = array( 'name' => $_POST['companyName'] ,'type' => $_POST['companyType'] ,'active' => '1'); $this->db->insert('company', $data); $cid = $this->db->insert_id(); $data2 = array( 'cid' => $cid ,'name' => $_POST['locationName'] ,'address' => $_POST['locationAddress']); $this->db->insert('locations', $data2); // This returns your first inserts id return $cid; } Controller public function add() { if (isset($_POST["add"])) { $id = $this->Compan

Categories : Codeigniter

What is the correct way to perform a 301 redirect in .htaccess for URLs with a parameter?
This should work given that you don't have other rules that may interfere with this one: RewriteCond %{QUERY_STRING} ^id=2$ RewriteRule ^display.php$ /about/ [R=301,L] RewriteCond %{QUERY_STRING} ^id=4$ RewriteRule ^display.php$ /news/ [R=301,L] If the domain is not the same domain then you may include the full qualified domain as in: RewriteCond %{QUERY_STRING} ^id=2$ RewriteRule ^display.php$ http://www.url.com.au/about/ [R=301,L]

Categories : Htaccess

scope and benefit of implicit parameter request in a scala play action?
1) Yes, the scope of the request is within the action block 2) Sorry, don't understand this question In general you should use implicits sparingly. We think the use of an implicit to pass around the request is reasonable in this particular context.

Categories : Scala

Redirect to an action with parameter and model binder doesn't work
I recommend using Controller.RedirectToAction instead. There are lots of overloads of it that should enable you to re-route to the Controller/Action you require, with any parameters that are pertinent.

Categories : Asp Net Mvc

How can I set rails routes to redirect some urls to another controller with parameter and default action?
match '/alias4(/:action)' => redirect("/original/4/%{action}"), :defaults => { :action => "show" } should work. Source: http://guides.rubyonrails.org/routing.html#defining-defaults .

Categories : Ruby On Rails

Facebook Oauth Issue | Multiple redirect with changing "code" parameter value in redirected url
I think I had a similar issue. When you get a request with the 'code' parameter, then you will want to send that back to FB. Doing so will allow you to get an 'access_token' in return. Relevant documentation can be read at this link: Login Flow And for clarity you would want to exchange the 'code' parameter for and 'access_token' by this GET request. GET https://graph.facebook.com/oauth/access_token? client_id={app-id} &redirect_uri={redirect-uri} &client_secret={app-secret} &code={code-parameter} In general, your question is similar to this question: Get Facebook OAuth token from code parameter

Categories : Java

Play JPA Query Example
your named query is correct and you can write it above the entity @Entity @Table(name = "Foo") @NamedQuery( { @NamedQuery(name = "findFoo", query = "select f from Foo f where f.state in :stateInList") )} public class Foo { .... }

Categories : Java

How to run a JPA Query in Play Framework 1.2.5
You have to import the Query class. import javax.persistence.Query; Doesn't your IDE flag such errors? SHouldn't you be able to fix basic compilation errors before using Play and JPA? Start by learning the basics of Java. Also, select * from Book is not JPQL. select b from Book b is.

Categories : Java

htaccess redirect dynamic url with no query string to query string version
Reason why it is not working is because %1 is the matching group captured in RewriteCond and you aren't capturing anything in your RewriteCond. Variables captured in RewriteRule are denoted by $1, $2, $3 etc. Replace your code with this: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{QUERY_STRING} ^$ RewriteRule ^([^.]+..+)$ /link-building-services/?website=$1 [R=301,L]

Categories : Htaccess

foreign key query play! framework 2.+ ebean
if you add a regIds field to your RegUsers definition like this: @Entity public class RegUsers extends Model{ public static Finder<Long,RegUsers> find = new Finder<Long,RegUsers>(Long.class, RegUsers.class); @Id public Long id; public String email; public String name; @OneToMany(mappedBy="regUsers") public Set<RegId> regIds; } you can query for RegUsers that have at least one RegId like this: RegUsers.find.where().isNotNull("regIds.id").findList() if you want to find RegUsers with exactly one RegId then you need to write custom sql indeed.

Categories : Java

Htaccess redirect with query
you forgot the 1 after %, i have also changed the search string so it can be anything instead of just number. RewriteCond %{REQUEST_URI} ^/search/?$ RewriteCond %{QUERY_STRING} ^search=([^&]*)$ RewriteRule ^(.*)$ /search/?rs=%1 [L,R=301]

Categories : Htaccess

Redirect remove query
By adding the ? at the end on the right hand of the RewriteRule it will not pass the query string to the next URL: RewriteRule ^mypage/subpage/$ /tempage/index.html? [R=302,L] And if you want it to work for mypage/subpage/ with and without the ending /, such as mypage/subpage then use it like this: RewriteRule ^mypage/subpage/?$ /tempage/index.html? [R=302,L] From HTTPD 2.4 and above you also have the QSD flag, which can be used like this: RewriteRule ^mypage/subpage/?$ /tempage/index.html [R=302,QSD,L] The QSD flag discard any query string attached to the incoming URI.

Categories : Htaccess

How to 301 redirect old query string?
Check wether the GET variable cat is set with the value 'likes', you can check this within your site/index or tag/tagName. After which you can redirect using PHP's header(). Something like this: public function actionIndex() { if ($_GET['cat'] == 'likes') { header('Location: /site/index?cat=popular', false, 301); } ... } You can also use your beautified URL. public function actionIndex() { if ($_GET['cat'] == 'likes') { header('Location: /popular-today', false, 301); } ... }

Categories : Htaccess

Creating optgroup in play framework from a query result
This may not be the best way, but you could represent department as a model and do it this way : User model : public class User extends Model { public String name; @ManyToOne public Department department; } Department model : public class Department extends Model { public String name; public List<User> getUsers() { List<User> users = new Arraylist<User>(); if (this.id != null) { users = User.find("department.id is ?", this.id).fetch(); } return users; } } Then in your view you can generate your select box list this way <select> #{list departments, as : 'department'} <optgroup label="${department.name}""> #{list department.users, as : 'user'}

Categories : Misc

htaccess query string redirect
Well, if you don't mind having a bunch of &'s at the end of your encoded URL, you can use optional captures and encode the & by hand. Something like: RewriteCond %{QUERY_STRING} ^([^&]+)(?:&(.*)|)$ RewriteRule ^admin/(.*)?$ /login.php?redirect=/admin/$1\%3F%1\%26%2 [L,NE,R] So if you go to: http://example.com/admin/test.php?a=1&b=2 you get redirected to: http://example.com/login.php?redirect=/admin/test.php%3Fa=1%26b=2 However, going to: http://example.com/admin/test.php?a=1 will redirect you to: http://example.com/login.php?redirect=/admin/test.php%3Fa=1%26 and your php script will extract the $_GET['redirect'] parameter as: /admin/test.php?a=1&. As long as you don't mind having that stray ampersand at the end. If you have a lot of possible variables, a

Categories : PHP

htaccess 301 redirect query to new domain
Try this RewriteEngine On RewriteCond %{QUERY_STRING} ^id=123$ RewriteRule ^/?product.php$ http://website.com.au/product_123.php? [L,R=301] Or RewriteEngine On RewriteCond %{QUERY_STRING} ^id=([^&]+) RewriteRule ^/?product.php$ http://website.com.au/product_%1.php? [L,R=301]

Categories : Htaccess

redirect query string url to a static url
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} (^|&)title=abc(&|$) [NC] RewriteRule ^a/b/(.*)$ http://www.mysite.com/xyz/asdf/? [L,R=302,NC] Remember RewriteRule doesn't match leading slash. Once you verify it is working fine, replace R=302 to R=301. Avoid using R=301 (Permanent Redirect) while testing your mod_rewrite rules.

Categories : Htaccess

HTaccess Redirect is adding query to end of URL
If you don't want a query to appear after a rewritten URL, in theory you could use the [QSD] flag (Query String Delete I think it stands for). In practice however it sometimes doesn't work too well in my experience. Instead, add an empty query string to your new url: RewriteRule ^.*$ http://www.badexample.com? [R=301,L] This will stop any additional query string being added.

Categories : Apache

apache redirect with query string
Change your .htaccess code to RewriteEngine on RewriteCond %{QUERY_STRING} ^book_id=([0-9]*)&course_id=([0-9]*)$ [NC] RewriteRule add_student.php https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L] This makes sure that nothing else about the URL gets changed except its protocol.

Categories : PHP

Redirect URL by query string match?
You can do this with mod_rewrite like this: RewriteCond %{QUERY_STRING} ^/knowledgebase/$ RewriteRule ^index.php$ /knowledgebase/ [L,R=301] Edit: When debuging htaccess rewrite rules I find this tool very useful

Categories : Htaccess



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.