logo
down
shadow

Rewrite URL empty values in query string - Double slashes, Optional Parameters


Rewrite URL empty values in query string - Double slashes, Optional Parameters

By : user2951432
Date : November 18 2020, 11:13 AM
hope this fix your issue I have looked around quite a bit and tried myself and could not sort it out. , Change your rules to this:
code :
RewriteEngine On
RewriteBase /job-search/

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.*?)(?:\+|%20|\s)+(.+?)\sHTTP [NC] 
RewriteRule ^ /%1-%2 [L,NE,R]

RewriteCond %{THE_REQUEST} \?searchText=([^\s&]+)&searchCity=&searchYear=(\d+)&action=([^\s&]+)&searchJobTitle=\s [NC]
RewriteRule ^ %1/%2/%3/? [R=302,L,NE]

RewriteCond %{THE_REQUEST} \?searchText=([^\s&]+)&searchCity=([^\s&]+)&searchYear=(\d+)&action=([^\s&]+)&searchJobTitle=([^\s&]+) [NC]
RewriteRule ^ %1/%2/%3/%4/%5? [R=302,L,NE]

RewriteRule ^([^/]+)/([^/]+)/(\d+)/([^/]+)/([^/]+)/?$ ?searchText=$1&searchCity=$2&searchYear=$3&action=$4&searchJobTitle=$5 [NC,L,QSA]

RewriteRule ^([^/]+)/(\d+)/([^/]+)/?$ ?searchText=$1&searchYear=$2&action=$3 [NC,L,QSA]


Share : facebook icon twitter icon
Apache .htaccess Rewrite Query String with slashes

Apache .htaccess Rewrite Query String with slashes


By : Pheckphul
Date : March 29 2020, 07:55 AM
it helps some times
This is bad idea to include file which name was passed from user. At least implement very STRONG validation, otherwise prepare to be hacked.
rewrite urls with slashes ( %2F ) in query string

rewrite urls with slashes ( %2F ) in query string


By : Gideon Mantell
Date : March 29 2020, 07:55 AM
it should still fix some issue I find your case peculiar because in Apache's mod_rewrite module (I'm not sure about IIS) it's stated that RewriteRule patterns are matched against the, I quote, "(%-decoded) URL-path (or file-path, depending on the context) of the request".
What I'm experiencing though after testing is that the encoded slashes are not decoded or not interpreted by the server (I too get an 404 error).
code :
RewriteRule ^(.+) index.php?word=$1 [L]
<pre>
    <?php var_dump( $_GET, true ); ?>
</pre>
<?php
array (size=1)
  'word' => string 'word1/word2' (length=11)
?>
How to keep double slashes in IIS rewrite?

How to keep double slashes in IIS rewrite?


By : user2961436
Date : March 29 2020, 07:55 AM
To fix the issue you can do go/http://google.com is not a valid url. You need to have it url encoded first, i.e. go/http%3A%2F%2Fgoogle.com
Rewrite Rule in htaccess convert query string into slashes php

Rewrite Rule in htaccess convert query string into slashes php


By : Syed Ammar
Date : March 29 2020, 07:55 AM
I wish did fix the issue. OK I've tried multiple solutions but still can't achieve it. so what I need to do is , Have your site root .htaccess as this:
code :
Options -MultiViews
RewriteEngine On
RewriteBase /jobportal/

# To externally redirect /search.php?q=product&l=london to /search/query/london/
RewriteCond %{THE_REQUEST} /search(?:\.php)?\?q=([^\s&]+)&l=([^\s&]+)\s [NC]
RewriteRule ^ search/%1/%2/? [R=301,L,NE]

# To externally redirect /search.php?q=product to /search/query/
RewriteCond %{THE_REQUEST} /search(?:\.php)?\?q=([^\s&]+)\s [NC]
RewriteRule ^ search/%1/? [R=301,L,NE]

# To externally redirect /dir/file.php to /dir/file
RewriteCond %{THE_REQUEST} \s/+(.+?)\.php\s [NC]
RewriteRule ^ %1 [R=301,NE,L]

# ignore all rules below for real files/directories
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

# internal forward from /search/product/ to search.php?q=product
RewriteRule ^search/([^/]+)/?$ search.php?q=$1 [NC,L,QSA]

# internal forward from /search/product/london/ to search.php?q=product&l=london
RewriteRule ^search/([^/]+)/([^/]+)/?$ search.php?q=$1&l=$2 [NC,L,QSA]

# internal forward from /dir/file to /dir/file.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
Regex for URL rewrite with optional query string parameters

Regex for URL rewrite with optional query string parameters


By : user7337579
Date : March 29 2020, 07:55 AM
wish of those help
When I look at your rule, I understand that you are looking for a complete match (^...$) with URL Path.
code :
<rule name="rentals by proptype+state+city+street test" stopProcessing="true">
    <match url=".*" />
    <conditions>
        <add input="{UNENCODED_URL}" pattern="^/([a-zA-Z0-9\-+]+)/rent/province/([a-zA-Z\-+]+)/street/([a-zA-Z0-9%\-+]+)/([0-9a-zA-Z%\-+']+)" />
    </conditions>
    <action type="Rewrite" url="search_new.aspx?proptype={C:1}&amp;province={C:2}&amp;city={C:3}&amp;street={C:4}" appendQueryString="true" />
</rule>
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org