Submit values and redirect user from to external URL

What is the equivalence of:


in Drupal 7 ?

I already use following code in my form submit handler, but it doesn’t work:

function Chargingform_nameform_submit($form, &$form_state) 
    $options = array();
    $options = array(
        'method' => 'POST',       
        'xml' => $form_state['values']['xml'],
        'sign' => $form_state['values']['sign'],
        'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),          

   $url = ''; 
   $response = drupal_http_request($url, $options);

How I can submit XML, sign to URL and redirect user to that URL at the same time?

This is my code:

function Chargingform_nameform() {
    $xml = 'PHP Handbook30000130000This is good book.MySQL Handbook25000250000This is a good book too.';
    // Get sing
    $sign ='ewtnXYRWPSalHhna9hgO+Kc0W9Z8JBUeG1FkcKPvZL5w2s588c0/B9r';

    $form['xml'] = array(
       '#title' => t('xml'),
       '#type' =>'hidden',
    $form['sign'] = array(
       '#title' => t('sign'),
       '#type' =>'hidden',
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('submit'),
    return $form;

function Chargingform_nameform_submit($form, &$form_state) {  
  $options = array();   
  $options = array(
    'method' => 'POST',       
    'xml' => $form_state['values']['xml'],
    'sign' => $form_state['values']['sign'],            
  $url = 'https//:url';    
  $response = drupal_http_request($url, $options);   

I don’t know really how to manage it in JavaScript.

Any suggestions?

All topic

AWS naked domain redirect when using CloudFront

I’m in the process of setting up a static website which is hosted on S3, uses a TLS certificate provided by Certificate Manager and is fronted by CloudFront.

I’ve been trying to find an authoritative resource which will help me understand how to configure the various services so that:,, will all be redirected to

So far, I’ve only come up with half-answers which cover doing this without CloudFront/TLS or which attempt to do the reverse mapping — to (I’m waiting for my most recent attempt at reverse engineering this to propagate but I’m not terribly confident it’s going to work.)

How can I achieve this?

All topic

Redirect 301 directive for Apache Sub directory and query string combining issue

I am getting 404 errors in google console. Some thing like this¤cy=ALL&orderby=price_desc

I want to redirect all of these on the home page of my site as they pages did not exists.

Problem # 1: I want to move any page that is under /newsite12121212121212/ or any of sub directory to home page no matter what is offer that, its may be a file or a sub directory.

Problem # 2: ?currency= some thing, take it back to home page. I tried

RewriteEngine On
RewriteCond %{QUERY_STRING} ^currency=$
RewriteRule ^$ [R=301,L]

Its working for the but fails on

All topic

Remove Query String from URL on Redirect – Redirection Plugin

I am trying to remove the query string from my URLs when I redirect them but it is preserving them. I can’t get the regex right.

Also, I have multiple templates that redirect to different urls so I can’t just use .* after howto.php

.htaccess is not an option in this case so I must figure out how to do this in the Redirection plugin

I want /templates/howto.php?page=template-business-plan

to go to


but i keep getting /business-plan?page=template-business-plan

All topic

Redirect http to https for certain path on an Nginx site

How do you redirect certain paths on an Nginx-hosted site from http to https?

I want to ensure everyone visiting the path “/admin” is behind https. Googling finds me several guides about how to add global rewrite rules, but I can’t find anything about how to add a rewrite rule for a specific site.

All the examples I see for doing this use the server{} syntax, which isn’t allowed in a site’s configuration file. What’s the site-specific syntax equivalent?

All topic

How to change the content of a text file when I don’t have permission to redirect output nor use `sed -i`

I would like to change the brightness on my laptop by changing the content of the file /sys/class/backlight/intel_backlight/brightness, but I can’t figure out how to do it.

I’m on Pop!_OS 18.04, which is essentially Ubuntu 18.04. Gnome 3.

Redirecting echo doesn’t work, due to permission problems.

$ sudo echo "0" > /sys/class/backlight/intel_backlight/brightness
zsh: permission denied: /sys/class/backlight/intel_backlight/brightness

Similarly for sed -i, I don’t have permission to create a temporary file.

$ sudo sed -i -e "s/.+/0/g" /sys/class/backlight/intel_backlight/brightness
sed: couldn't open temporary file /sys/class/backlight/intel_backlight/sedk0tgUG: Permission denied

So what else can I try? Thank you.

All topic

Apache redirect to index.php

I’ve got the below virtual host configuration on Centos 6.5 running apache 2.4.

        DocumentRoot /var/www/
        DirectoryIndex index.html
        RewriteEngine on
        RewriteRule ^index.html$ index.php$1 [L,R=301]
        ErrorLog /var/www/
        CustomLog /var/www/ combined

When I go to server_IP:4323 the default HTTP page comes up. How could I get the redirection to index.php working please?

The httpd.conf configuration is here

The apache details below –

Server version: Apache/2.2.15 (Unix)
Server built:   Mar 22 2016 19:03:53
Server's Module Magic Number: 20051115:25
Server loaded:  APR 1.3.9, APR-Util 1.3.9
Compiled using: APR 1.3.9, APR-Util 1.3.9
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

All topic

How do I test an https redirect in ASP.NET Core?

Recently, I came up with unit tests for checking some redirect rules of my ASP.NET Core 2.1 application:

[Fact(DisplayName = "lowercase path")]
public async Task LowercaseRedirect()
    var result = await this.Client.GetAsync("/BLOG/");
    Assert.EndsWith("/blog/", result.RequestMessage.RequestUri.PathAndQuery, StringComparison.InvariantCulture);

[Fact(DisplayName = "add missing slash")]
public async Task SlashRedirect()
    var result = await this.Client.GetAsync("/blog");
    Assert.EndsWith("/blog/", result.RequestMessage.RequestUri.PathAndQuery, StringComparison.InvariantCulture);

FYI: I am currently injecting the WebApplicationFactory into my test class, which I use to create my HttpClient.

But now I am curious how to check if the https redirect is working. Any ideas how to accomplish that? Thanks in advance 🙂

All topic

Redirect based on client IP

I’m implementing SSO with Simple Saml PHP Auth. It works great but UX has mandated that internal users should not have to click anything to login. How can I forward users on our intranet to our saml url ( and external users to the normal url (

All topic

remove slash from url with htaccess redirect

i am using this to redirect url

example in my htaccess fike

RedirectMatch 301 ^/user/(.*)?$ http://$$1

but it redirect to http://koko/

how can i remove the slash from http://koko/

i have tried couple answers that i found here but did not work
thank you

All topic