Redirect query string URL via .htaccess

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

Search query example www.example.com/?s=cars to resolve to www.example.com/?search_gcse/?q=cars (“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?

EDIT:

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?

EDIT2:

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:

https://www.example.com/catalogue/catalogue.php?catSection=1

to

https://www.example.com/hire-category/access-support-equipment/

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 https://www.internorm.de/ there is no further redirect, so I really don’t understand what is the problem here.

when I am entering only: https://internorm.de it will do a 301 redirect first to https://www.internorm.de

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)
</IfModule>
# END WordPress

ErrorDocument 404 /404-error/

Update: I have now noticed, that some images are transferred over internorm.de/path_to_image instead of www.internorm.de/path_to_image 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)
</IfModule>

# END WordPress
    
# SET CACHE
<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>
    <FilesMatch ".(xml|txt|js|css|json)$">
    Header set Cache-Control "max-age=604800, public, must-revalidate"
    </FilesMatch>
    <FilesMatch ".(html|htm|php)$">
    Header set Cache-Control "max-age=28800, must-revalidate"
    </FilesMatch>
</IfModule>
# ZIP IMAGES
<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
</IfModule>

# 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
</IfModule>
# 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 http://mywebsite.com, I got that same error.

When I tried https://www.mywebsite.com, it loaded fine. But not other pages only homepage

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

Advertising

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 192.168.1.228:8081 to the ip 10.0.67.245: 8080 through the interface eth18 with ip 192.168.0.2 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 192.168.1.228 --dport 8081 -j DNAT --to-destination 10.0.67.245:9980
iptables -A FORWARD -p tcp -d 10.0.67.245 --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:
<?php
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
SEMrush

$tenant=$_POST(‘tenant’);
$rentpaid=$_POST(‘rentpaid’);
$rentdue=$_POST(‘rentdue’);
?>
<!DOCTYPE html><html>
<head>
<title>rent receipt</title>
</head>
<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>
</SELECT><br>
<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”>

<TABLE BORDER=”0″ CELLPADDING=”12″ CELLSPACING=”5″ >
<TD>
<TABLE BORDER=”30″ CELLPADDING=”12″ CELLSPACING=”5″>
<td>
<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>
<tr>
<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>
</tr></table>

</b></body></html>
—————————————
05/02/21
receiptno has been updated successfully !
Receiptno is receiptno
——————————————
the payment (from a form) code:
<?php
echo “<center>”;echo date(‘m/d/y’);echo “</center>”;
$id=”””;

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

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

$tenant=$_POST(‘tenant’);
$unit=$_POST(‘unit’);
$rentpaid=$_POST(‘rentpaid’);
$hudpay=$_POST(‘hudpay’);
$datepaid=$_POST(‘datepaid’);
$comments=$_POST(‘comments’);

$tenant=’tenant’;
$unit=’unit’;
$rentpaid=’rentpaid’;
$hudpay=’hudpay’;
$prevbal=’prevbal’;
$latechg=’latechg’;
$secdep=’secdep’;
$damage=’damage’;
$courtcost=’courtcost’;
$nsf=’nsf’;
$paidsum=’paidsum’;
$datepaid=’datepaid’;
$late=’late’;
$comments=’comments’;

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

<!DOCTYPE html><html>
<head>

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

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

<?php
// —————————————
while($row = mysqli_fetch_array($results)) {
// —————————————-
if(!empty($_POST(“update”)))
{
$mysqli->query(“Update paytbl SET
rentpaid = ‘$rentpaid’, datepaid = ‘$datepaid’, paidsum = ‘$paidsum’, hudpay = ‘$hudpay’,
comments = ‘$comments’
where unit = ‘$unit'”);
}
}
?>

</center></body></html>