A list of puns related to "Url Rewriting"
Greetings all!
I am using WordPress on my Synology DS218+ to host a simple website. It is working fine, but I wanted to hide the hostname of my NAS (you know, xxxx.synology.me/wordpress) so I purchased a domain name (let's call it newname.net) and pointed it at the NAS using URL forwarding at the DNS provider end. That works but all the user ever sees is the new domain name, not individual pages - for example, xxxx.synology.me/wordpress/about/ works but not newname.net/about/.
The domain name provider said I could sort this using URL rewriting, I would have to provide them with the 'code' though. They pointed me to a website to learn how to do this (https://www.smashingmagazine.com/2011/11/introduction-to-url-rewriting/) but it is doing my head in. The examples provided by this website, and others I've searched out, are not exactly what I am trying to do.
I cannot be the first Synology user to face this challenge. Can anyone offer a few pointers and (desirably) some sample code?
Hi community,
I have a question about the process of URL rewriting for parameters via the htaccess file.
My objective is to create clean URLs for a better user experience by converting the following:
url.com/user.php?username=John
To this:
url.com/user/John
Is there a single and general rewrite rule that can be used for any URL parameter name, or must I specifically define each rewrite rule for every individual parameter I will use throughout the whole website?
Examples would be immensely helpful.
Thanks everyone.
Hi all.
We are trying to reduce some technical debt/remove legacy applications in our ecosystem.
We've come across a simple .NET core app that a previous employee called "Domain Forwarder".
It essentially has a JSON list of hostname/hostname+path redirects and simply 301's.
For example, we have a bunch of legacy domains that have been setup with a rule to send them to a page on our website depending on what domain they are going to. If you go to abc123.com, you might 301 to ourwebsite.com/abc123.
This is setup in Azure on App Services and has all our legacy domains binded to it.
Is there a better tool/service that can handle all this for us? We want to reduce as many apps as possible so would be good if we had a service (preferably within Azure) that can handle forwarding of these domains/paths for us.
Thanks
i am trying to rewrite some of the pages url in my web app, for example i have a company details page and i want the url of this page to contain the name of the company without the space or special characters and to have the id too , and i have no idea on how to do that or where to start .
i tried adding the name of the company in the route beside the id but it didn't work, i'm already passing the id in the route .
here's what i tried to do :
i added RS which is the name of the company in the route
https://preview.redd.it/vyw5954ffya71.png?width=835&format=png&auto=webp&s=80a58fc5f3d5b402dc09128e77ef807d3a80e995
then i added it in the link :
https://preview.redd.it/mjthmepsfya71.png?width=891&format=png&auto=webp&s=e87f9a0dbeb45945a8b10364bcdee50dffcca4db
but i get the missing parameter error.
even if it worked there's no way to replace the special characters with their normal form and replace the space with dashes .
i searched a lot but i can't seem to find what i am looking for, i just need someone to help me find the right term .
Bonjour à tous, je vais débuter un nouveau tutoriel, celui des fichiers .htaccess !
Un fichier htaccess est un fichier destiné à gérer les informations internes et à configurer l'arborescence de votre Site WEB. Cela nécessite un serveur, vous retrouverez un tutoriel pour en configurer un gratuitement sur le Discord officiel de de Coding Time.
Pour en créer, il suffit de vous rendre sur le répertoire de votre site et de créer un fichier nommé .htaccess
, sans contenu avant l'extension.
Vous êtes prêt, commençons désormais avec l'URL Rewriting !
I/ L'URL REWRITING
L'Url rewriting
, comme son nom l'indique, consiste à "réécrire le lien". En réalité, un nouveau lien est généré qui sera redirigé vers un fichier choisis.
>!⚡Pour que la suite du tuto fonctionne correctement, le module Apache !<rewrite_module
>! doit être actif!<
Commençons maintenant en écrivant une première ligne : RewriteEngine On
. Ca va activer l'URL Rewriting en important les données du module Apache.
Ensuite nous allons rédiger la ligne qui va nous permettre de décorer un lien. Imaginons que nous voulons que mondomaine.com/aboutus redirige vers mondomaine.com/ressources/code/page/aboutus.php . Pour se faire, il faut d'abord écrire au début de la ligne la règle RewriteRule
. Ensuite, appliquez la valeur que vous voulez entre un accent circonflexe ^ et un dollar $, ce qui donne RewriteRule ^aboutus$
. Après un espace écrivez ensuite le chemin brut de votre fichier, soit ressources/code/page/aboutus.php
. Votre ligne de code ressemble finalement à RewriteRule ^aboutus$ ressources/code/page/aboutus.php
et vous en avez finis avec cet URL !
Notes :
-Si la syntaxe n'est pas exacte à lettre (hormis le nom de la décoration et le chemin qui varient en fonction de vos exigences et de votre arborescence de site), cela entraînera une erreur 500 : Internal Server Error
, faites-donc bien attention !
-Un seul URL par ligne sinon votre code sera cassé.
-Le fichier .htaccess doit être placé dans le répertoire général du dossier pour la bonne raison que les chemins commençant par ../ ne fonctionnent pas.
Example URL- https://www.google.com/search?q=ublock+origin ( this occurs on all search results)
Just before I click a result, it changes it to send it through google domains first. It also assigns a unique ID in the URL it sends. I want to avoid the rewriting of the URL. Is it possible?
I want to click - https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/
It changes to this-
Firefox 77 / uBO 1.27.10
I know I can add google.com/url$all to the filters and click the final result shown by uBO ( due to me adding that filter). But I want to prevent it from rewriting in the first place.
Make sure to add https://teams.microsoft.com to your whitelist for URL rewriting in emails.
We've had a weird issue for months when joining meetings with 3rd parties would get stuck on "Connecting" and would never work unless using the web link.
Turns out the Teams client can't handle links that have been rewritten so would just hang. Adding it to the whitelist resolved it :)
Hi, I'm trying to get mediawiki up and working. I have access to it on the local network (192.168.x.x/mediawiki), but not from the outside (wiki.domain.me). With this particular nginx config, it redirects wiki.domain.me to 192.168.x.x/mediawiki/index.php, which of course doesn't work from the outside.
In other scenarios, it will either throw a 403 Forbidden (uncommenting the autoindex line changes this behavior) or attempt to download a fragment of the index.php file as a file without an extension.
The config is based on this recipe from the Nginx wiki. LocalSettings.php is in the right place, and all of /var/lib/mediawiki/ is under www-data (then symlinked to /var/www/html/mediawiki/).
Any suggestions?
server {
listen 80;
server_name wiki.jamiehowe.me;
root /var/www/html/mediawiki;
client_max_body_size 5m;
client_body_timeout 60;
access_log /var/log/nginx/mediawiki/access.log;
error_log /var/log/nginx/mediawiki/error.log;
#index index.php;
location / {
try_files $uri $uri/ @rewrite;
# autoindex on;
index index.php;
}
location @rewrite {
rewrite ^/(.*)$ /index.php?title=$1&$args;
}
location ^~ /maintenance/ {
return 403;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
try_files $uri /index.php;
expires max;
log_not_found off;
}
location = /_.gif {
expires max;
empty_gif;
}
location ^~ /cache/ {
deny all;
}
location /dumps {
root /var/www/mediawiki/local;
autoindex on;
}
}
So I usually use .net but have to set something up on a shared site that has url rewriting turned off. But i can still use an htaccess file.
The incoming link looks like this:
http://www.test.com/s2/surv/SomeName/12/2610/randomcode
I need it to be read by a page in this format.
http://www.test.com/s2/surv.aspx?name=SomeName&id=12&secondaryID=2610&code=randomcode
I've used https://htaccess.madewithlove.be/ to check it and it says it should work but it's not.
AddHandler php5-script .php
RewriteEngine On
RewriteRule ^s2/(surv)/([_A-Za-z0-9()'-@|]+)/([0-9]+)/([0-9]+)/([_A-Za-z0-9]+)?$ /s2/surv.aspx?name=$2&id=$3&secondaryID=$4&code=$5 [NE,B,QSA,R=302,L]
Any help would be appreciated. It's close just don't know what I'm missing. Also the htaccess does work. I've tested that, it's just my code that's not redirecting.
I'm trying to do something that appears to not be possible with either the version of PAN-OS that I'm on (8.1), or at all, with GlobalProtect Clientless VPN.
In this case, I want only specific URLs to be rewritten to function behind the SSL VPN, such as those that are required for applications being presented to work (OWA, etc.). Any other URLs, such as those in an email pointing to other sites and domains, don't need to be rewritten or proxied.
The problem is, there seems to only be an exclude list within the portal config. I can exclude basic patterns, like *.net or *.youtube.com, but this is incompatible with my scenario. I want all but my internal URLs to be excluded, which usually means I need to have the equivalent of a 'default-deny' rule, with explicit include rules/patterns. If I try to bruteforce it by using * for the exclude list, I get this error:
Error: GlobalProtect Portal 'portal' exclude Domains match any urls, not supported.
Which makes sense, as this would seem to break all URL rewriting, including what is required for clientless apps. Additionally, even if I were to define every single possible top level domain, it is clear that all links are still being rewritten, but instead of being proxied, they're handled with a 302 redirect to their intended target.
I'm familiar with how PulseSecure and other SSL VPNs are configured, where they can have an explicit include list rather than an explicit exclude list.
Am I missing something, or is this a definitive limitation within GlobalProtect's Clientless VPN?
I am trying to do some url rewriting before passing it to my backend application. Basically for path /scopus/
proxy to my backend without stripping /scopus/
but when the path is /scopus/swagger-ui,html
strip the /scopus
and then just pass /swagger-ui,html
to the backend. Can this be achieved in 1 location block. The reason for this is the backend APIs has all /scopus
prefix and wont work without it. But the swagger-ui also wont work with /scopus in the path.
nginx.conf: |-
server {
listen 80 default_server;
listen [::]:80 default_server;
location /scopus/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header Host $host;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_connect_timeout 300s;
rewrite ^/scopus/swagger-ui.html$ /swagger-ui.html$1 break;
proxy_pass http://localhost:5000;
}
}
Hello,
To clean up some urls of my website from some internal tracking parameters, I'm thinking of using cloaking.
The idea is to serve to Google Bot or any other Search Engine Crawler a clean URL, but not the user.
Here's an example to illustrate what I mean
To go from a page A -> To a Page B
What Google Bot will see :
Url of page A : Domaine.com/A
Url of page B : Domaine.com/B
What the User will see:
Url of Page A : Domaine.com/A
Url of Page B : Domaine.com/B?source=PageA
The content of the B Page is the same with or without parameters.
The main idea is to reduce the number of urls with parametres that google crawls.
What do you think about that ?
Thanks
I've pasted my web.config file (without my connection strings) to pastebin for review: https://pastebin.com/cqKkH4D2
So I uploaded my client's website to http://sunrise.loganyoung.co.za this past weekend, but I keep getting an HTTP 404 on the login page at http://sunrise.loganyoung.co.za/Account/Login
If I add the .aspx to the URL, it rewrites to the above and I think this is screwing with the server since I haven't created any URL rewrite rules there. Thing is, I can't find any settings on the website to turn this off.
I know for a fact that the page is actually there so logically this has to be a config issue right?
The server is a Windows Server 2012 R2 running IIS 8.
Any ideas how to at least stop this rewriting to allow for further troubleshooting? I'm at a bit of a loss in all honesty.
Hello,
I am a student and I choose to put a website that I did on google app engine (GAE). I did it and everything works except that the app.yaml's url rewriting doesn't work with $_GET variable and GAE don't use Apache, so I can't use .htaccess file to do url rewriting.
So I do this post to ask help about this tutorial on the official GAE documentation but I don't really understand it and succes to make it works so if someone could help it would be very nice
PS : The result that I would want to have is /articles/14 and not /articles?id=14 in my url
thanks
I need a proxy map statement to rewrite the url based on an IP address.
https://external-IP/irj/portal/external
https://internal-IP/irl/portal
I have my internal IP address subnets in the map statement currently. Where should I put the rewrite lines, does it need to go inside of the location block?
map $remote_addr $proxy_pass_map {
"~^10\.10\..*\..*$" https://10.10.4.15:50001;
"~^10\.20\..*\..*$" https://10.10.4.15:50001;
"~^10\.30\..*\..*$" https://10.10.4.15:50001;
default https://10.10.4.15:50001;
}
server {
listen 443 ssl;
server_name WebportalURL.XX.XX.XX.XX;
ssl_certificate /etc/nginx/XXXX.pem;
ssl_certificate_key /etc/nginx/XXXX.key;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header x-real-IP $remote_addr;
proxy_set_header x-forwarded-for
$proxy_add_x_forwarded_for; proxy_set_header host $host;
proxy_pass $proxy_pass_map;
rewrite ^/$ /irj/portal;
}
}
Does anyone know if its possible to write filters which can rewrite/redirect URLs, now that corelibs is part of Android? For eg, one of the things I'd like to do is rewrite/redirect IMDB URLs to always use the desktop version. I remember one of the devs mentioned sometime last year or so that this should be possible with the new engine once its implemented.
So all I'm trying to do is rewrite this url: http://domain.com/searchterm
...to be: http://domain.com/index.php?input=searchterm
This is what a couple of different .htaccess generating sites agree will do that: > RewriteEngine On > #RewriteRule ^ ( [ ^ / ] * ) $ /index.php?input=$1 [L]
(I had to space that out because reddit was intepreting the ^ as superscript, but everything from the first ^ to the first $ was contiguous with no spaces)
...but every time I apply this config, my entire site is unusable and returns 500 internal server errors.
I don't think the rewrite rule is wrong - I think there might be something to do with the configuration of my site, which is hosted on Dreamhost (who say they "fully support" mod_rewrite). I just have no idea what that thing might be because this is the first time I've wanted to do something like this and have zero experience.
Any ideas, or even suggestions on where I should start looking for a solution?
I have kind of a weird question that I haven't been able to figure out. Here's what's up.
I have a client with a WordPress site. Someone wrote a custom booking system in a subdirectory, and I wrote and admin backend in CakePHP 2.0 (yes, yes, I know, I should have used 3.0) to manage it. So it's set up like this:
The booking system works fine as long as the admin directory isn't there. But if the admin is there example.com/booking
redirects to example.com/booking/users/login
. The admin app is authenticated, so it's supposed to redirect to example.com/booking/admin/users/login
but for some reason I can't get it to run the index.php that's in ```example.com/booking`` and ignore the Cake app.
I'm trying to avoid rewriting the custom PHP app because it's a pile of spaghetti and I didn't want to touch it. Is there some Apache config that I can use?
Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.