Redirect query string URL via .htaccess

I am trying to redirect all query strings to a new URL.

Search query example to resolve to (“cars” is just an example).

What is the syntax for the .htaccess rule?

Redirect all posts to home page when change permalinks in wordpress

I have installed WordPress on my host. The site has no problem but I want to change Permalinks. When I change WordPress Permalinks in settings and save it all posts and categories pages Redirect to home page and I can open only home page! When I change site theme to default the problem solved! What is incorrect in my theme? What the problem?

8 – Redirect after user creation via form

What would be the proper hook to redirect after the user registration form is submitted and is in valid state?

I’m trying to automatically create a certain content-type node when a user registers and I want to redirect the user to that node’s edit form after the user creation form is submitted and validated.

I was thinking of doing this in a mymodule_user_form_submit hook, but not sure if a) this hook exists and b) the validation in place for user registration will still work as intended.

Can anyone share some pointers?


Would the mymodule_user_insert hook run after the validation and submission of the form? Can I redirect from there? AFAIK, I won’t have a form_state variable to act on, right?


While researching for a solution, I noticed I have another (probably bigger) problem: the content-type node I need to create must hold a reference to the user’s ID, so I’m getting in a chicken-or-egg situation.

I actually need to create said node after the user is created (otherwise I’ll have no user_id), but I need to redirect to the node’s edit form after user creation, which means I can’t redirect with $form_state.

I think I got everything right, but I would love to be wrong. 😀

Can anyone help?

nginx – redirect (nat?) by subdomain to docker

I managed this for HTTP requests with nginx but there you have to specify every port you want to use. I would like to redirect all the ports and protocols at once. Technically mapping the IP of the docker to the subdomain.

HTTP(S) includes a host name in the header, to explicitly allow virtual hosting of this kind.

Other protocols, however, don’t.

NAT and port forwarding happens on TCP/IP or UDP packets, which does not contain any information about domains. The domain name is resolved by the client system, which then will use the IP it resolves to in the packets to address them.

So no, you can’t do what you want to do, unless your protocol supports a hostname field, or you have multiple IP’s – one per subdomain.

301 Redirect from URL with query string to new URL without query string

I’m having trouble working out how to do a 301 redirect from:


I’ve tried a few things including from this thread: Remove query string from 301 redirect URL

RewriteCond %{QUERY_STRING} =catSection=1
RewriteRule ^catalogue/catalogue.php$ /hire-category/access-support-equipment/ [QSD,R=301,L]

But that isn’t working for me.

I would be massively grateful if someone could point me in the right direction.

Thanks all!

seo – why does google search console give me a redirect error?

I have added 2 properties for my domain in google search console:

when I check both of these properties inside search console URL validation tool, it shows me the following error: URL is not available for google, below that it shows the error: Redirect Error.

I have checked if there are some redirects in Chrome dev tool, but here when I am entering there is no further redirect, so I really don’t understand what is the problem here.

when I am entering only: it will do a 301 redirect first to

I have also checked if there is some misconfiguration within robots.txt, but there are also no errors there.

I am really confused about this, because when I enter the URL in regular browsers there are no problems at all, can anybody help me to find out what the issue here is?

this is my .htaccess file, which is just the default one that wordpress uses, so I also don’t think that there are any issues here:

# BEGIN WordPress
# Die Anweisungen (Zeilen) zwischen „BEGIN WordPress“ und „END WordPress“ sind
# dynamisch generiert und sollten nur über WordPress-Filter geändert werden.
# Alle Änderungen an den Anweisungen zwischen diesen Markierungen werden überschrieben.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - (E=HTTP_AUTHORIZATION:%{HTTP:Authorization})
RewriteBase /
RewriteRule ^index.php$ - (L)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php (L)
# END WordPress

ErrorDocument 404 /404-error/

Update: I have now noticed, that some images are transferred over instead of could this be maybe the problem?

redirect – 503 Service Unavailable error was encountered

When I try to upgrade PHP to version 7.4 or 7.3, I get the following error:

Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request.

I tried to rename plugins folder and switched back to old PHP version and deactivated all pluigns, But still the same.

I activated twenty twenty-one and twenty twenty themes from WordPress, But still the same.

Finally I tried to logout and upgraded to PHP 7.4 and I could see the homepage. But when I try to visit any other page like /wp-admin or pages in the menu like /contact, I get the same error again.

I think it could be from .htaccess. Here is the code there:

RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} (L,R=301)
RewriteCond %{HTTP_HOST} !^www. (NC)
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} (L,R=301)
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - (E=HTTP_AUTHORIZATION:%{HTTP:Authorization})
RewriteBase /
RewriteRule ^index.php$ - (L)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php (L)

# END WordPress
<IfModule mod_rewrite.c>
    <FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|swf|eot|woff2|woff|ttf|svg)$">
    Header set Cache-Control "max-age=31449600, public"
    <FilesMatch ".(xml|txt|js|css|json)$">
    Header set Cache-Control "max-age=604800, public, must-revalidate"
    <FilesMatch ".(html|htm|php)$">
    Header set Cache-Control "max-age=28800, must-revalidate"
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0(678) no-gzip
BrowserMatch bMSI(E) !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI 
.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php74” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
# php -- END cPanel-generated handler, do not edit

I tried to comment the first part which redirects to https:

#RewriteCond %{HTTPS} off
#RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} (L,R=301)
#RewriteCond %{HTTP_HOST} !^www. (NC)
#RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} (L,R=301)

And when I tried to visit, I got that same error.

When I tried, it loaded fine. But not other pages only homepage

Saw this site doing lots of google redirect how they do it?


y u no do it?

Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

Starts at just $1 per CPM or $0.10 per CPC.

forwarding – how to redirect and mascarede iptables

I need to redirect the interface eth 19 with ip to the ip 8080 through the interface eth18 with ip since, due to network restrictions, only this ip can centralize consumption.

I’ve been testing with:

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080:8086 -j ACCEPT

iptables -A FORWARD -i eth19 -j ACCEPT
iptables -A FORWARD -o eth19 -j ACCEPT

iptables -A FORWARD -i eth18 -j ACCEPT
iptables -A FORWARD -o eth18 -j ACCEPT

iptables -t nat -A POSTROUTING -o eth18 -j MASQUERADE

iptables -t nat -A PREROUTING -p tcp -i eth19 -d --dport 8081 -j DNAT --to-destination
iptables -A FORWARD -p tcp -d --dport 9980  -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

as the direct forwarding option.

redirect to the receipt

Hi, a little prob with code. I have a payment program and want to follow with the receipt. The following
code is the receipt.
1) I’ve tried to redirect to the receipt file after payment. I have yet to achieve that.
2) I want the receipt# on the receipt. I swear, I’m trying
3) I need to send 3 variables to the receipt program, you’re probably laughing thinking how simple this is
I’ve poured thru the manuals & forums and the discussions are far past my little efforts. Pointers, anything?
the code:
echo “<center>”;echo date(‘m/d/y’);echo “<br />”;

// Include config file
require_once “getprerentdb.php”;

//MySqli Select Query
$results = $mysqli->query(“SELECT * FROM numberstbl”);
$receiptno = “receiptno”;
$sql = ” UPDATE numberstbl
SET $receiptno = $receiptno + 1 where id=$id “;
echo “receiptno has been updated successfully !”;
echo “<center>”;echo “Receiptno is $receiptno”;echo “<br />”; // doesn’t work

<!DOCTYPE html><html>
<title>rent receipt</title>
<body><center><font size=+1>
<img src=”apt-pic.jpg” alt=”apartment” height=250 width=800><br>

For:<SELECT name=”options”>
<option value=”#990033″ style=”background-color: Violet;”>Rent payment</option>
<option value=”#003300″ style=”background-color: Aquamarine;”>Background Check</option>
<option value=”#6600cc” style=”background-color: Pink;”>Security Deposit Payment</option>
<option value=”#003300″ style=”background-color: Aquamarine;”>Damages Payment</option>
<option value=”#990033″ style=”background-color: Violet;”>Late Charges Payment</option>
<option value=”#003300″ style=”background-color: Aquamarine;”>Court Costs Payment</option>
<option value=”#6600cc” style=”background-color: Pink;”>NSF Payment</option>
<option value=”#990033″ style=”background-color: Violet;”> </option>
<input type=”text” size = 25 STYLE=”color: #000000; background-color: #D4AAFF;” name=”Name” value=”Business Name”>
<input type=”text” size = 25 STYLE=”color: #000000; background-color: #D4D4FF;” name=”Addy1″ value=”Business address”>
<input type=”text” size = 25 STYLE=”color: #000000; background-color: #D4AAFF;” name=”Addy2″ value=”City, State, Zip”>

<input type=’text’ size = 30 STYLE=”color: #000000; background-color: #D4AAFF;” name=”from”
value=”<?php echo( htmlspecialchars($row(‘tenant’) ) ); ?>” /></td>
<td><input type=’text’ size = 10 STYLE=”color: #000000; background-color: D4D4FF;” name=”amt”
value=”$ <?php echo( htmlspecialchars($row(‘rentpaid’) ) ); ?>” /></td>
<td><input type=’text’ size = 10 STYLE=”color: #000000; background-color: D4D4FF;” name=”due”
value=”$ <?php echo( htmlspecialchars($row(‘rentdue’) ) ); ?>” /></td>
<td><input type=”text” size=”25″ name=”sign” value=”Sign here” STYLE=”color:
#000000; font-weight: bold; background-color: #ffccff;” onFocus=”this.value=””></td>
<td colspan=2 align=”center”><input type=”text” size=15 name=”thanks” readonly value=”We Thank You:” STYLE=”color:
#000000; font-weight: bold; background-color: #ffccff;” onFocus=”this.value=””></td>

receiptno has been updated successfully !
Receiptno is receiptno
the payment (from a form) code:
echo “<center>”;echo date(‘m/d/y’);echo “</center>”;

// Include config file
require_once “getprerentdb.php”;

//MySqli Select Query
$results = $mysqli->query(“SELECT * FROM paytbl”);



$owe = $prevbal + $latechg + $secdep + $damage + $courtcost + $nsf;
$rentpaid=$owe; $paidsum=$owe;

<!DOCTYPE html><html>

<STYLE TYPE=”text/css”>
.blue {background-color: #ccffff;}
.tan {background-color: #FFD4FF;}
h1.centered-cell {text-align: center;font-size: 1.1em;}

<body><center><b><font size=+1>Rent Payment</b><p>

// —————————————
while($row = mysqli_fetch_array($results)) {
// —————————————-
$mysqli->query(“Update paytbl SET
rentpaid = ‘$rentpaid’, datepaid = ‘$datepaid’, paidsum = ‘$paidsum’, hudpay = ‘$hudpay’,
comments = ‘$comments’
where unit = ‘$unit'”);