Questions tagged [mod-rewrite]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
356 views

htaccess RewriteRule regular expression for url with any nesting

There is a site example.com/aaaa/bbbb/cccc/.../zzzz, where /aaaa/bbbb/cccc/.../zzzz is a path with any nesting. If the URL contains a file or directory starting with a dot (hidden file or directory) ...
Вова Дорошенко's user avatar
0 votes
1 answer
311 views

How to mask a URL on a different port with htaccess rewrite

I have a page with a URL like this: https://example.com:3000/newsite but I want to be able to access it from here: https://example.com/newsite and mask the URL as well so it will always show ...
Cain Nuke's user avatar
  • 179
1 vote
1 answer
812 views

RewriteEngine gives error 500 internal server error for 404 pages - apache2

I wanted to replace the .html extensions with just nothing in apache. Eg. DNS/coffee.html to be DNS/coffee. I found myself this code. <IfModule mod_rewrite.c> RewriteEngine on ...
TheRealOne78's user avatar
0 votes
1 answer
74 views

Apache use case

I use Apache to serve several sites to the world on my home server on port 443 using an SSL certificate. Last night I installed a linux binary that serves a site only on a port defined via its config ...
Martin Collins's user avatar
0 votes
2 answers
587 views

How to rewrite everything to HTTPS except for port

I installed Netdata on a webserver to get statistics. To see those I should use: http://whatever:19999. However, everything gets redirected to HTTPS on my webserver using: RewriteEngine On ...
Supr0's user avatar
  • 7
0 votes
1 answer
250 views

htaccess to Nginx rewrite rules

I've converted apache htaccess rules to nginx rewrite rules but they are not working for me. Apache .htaccess rules RewriteEngine On RewriteBase /public/layout/themes/ RewriteCond %{...
Axel's user avatar
  • 147
1 vote
1 answer
3k views

Wordpress Permalinks not working even with mod_rewrite enabled

I'm trying to set up my local Wordpress instance for development. I've changed the permalinks to http://localhost/localwp/%postname%/ and my .htaccess file was updated successfully: screenshot of the ...
NathanPB's user avatar
  • 121
0 votes
1 answer
922 views

Multiple vhost on single domain

I'm facing an issue with virtual host and Apache in general. What I'm missing is more an explanation of the big picture of how it works rather than one specific command, let me explain: I have a ...
Okeur's user avatar
  • 63
0 votes
1 answer
59 views

mod_rewrite apache2.4 rule not working

I am trying to configure .htaccess for a very simple URL redirect with Apache 2.4 From: /order/step1.php?service=151 To: /order/step-1/151 My .htaccess is: RewriteEngine On RewriteRule ^/?/([^/d]+)/...
ZCT's user avatar
  • 1
0 votes
1 answer
453 views

Apache to Nginx mod_rewrite rule

I converted some mod_rewrite rules for nginx and they were working fine when I tested it locally but for some reason they are not working on my website. Can anyone help where I'm going wrong? Apache ...
Axel's user avatar
  • 147
0 votes
1 answer
60 views

Regular expression

I need to write a mod_rewrite rule that would match the following string: /modules/users/users/ae/ghwjzL9D2qpnPqv3FRY3JTZ48N the only constant part of the string is /ae/. I need a regular ...
Andrew K's user avatar
1 vote
1 answer
414 views

How I can add Rewrite rule in htaccess only for home page?

I have a problem with apache. My site has these rules now: RewriteCond %{HTTP_ACCEPT} text/html [NC] RewriteCond %{HTTP_HOST} ^mysqite\.com [NC] RewriteRule .* path/to/html/my.html [L] I need ...
Win32Sector's user avatar
1 vote
1 answer
51 views

SSL forwarding for just one subdomain in .htaccess

I have Apache(ubuntu) server and I need to force https just for sub1.domain.com. Currently all traffic are being forwarded RewriteEngine On RewriteCond %{HTTPS} ...
SkyPunch's user avatar
1 vote
0 answers
535 views

redirect subdirectory requests to alternate server:port

I'm using the following .htaccess to redirect requests to domain root ( http://example.com ) in apache to an alternate webserver on the same host listening on an alternate port ( http://example.com:...
Luky's user avatar
  • 111
1 vote
2 answers
741 views

How to map sub domain to internal IP adress

I'd like to reach some internal services like the web client of my NAS (Synology DSM) through dedicated sub domains like https://nas.example.com. The services are fully running and accessible via ...
suamikim's user avatar
  • 337
0 votes
1 answer
701 views

Removing lingering end string after RewriteRule

I've tried everything but just can't seem to get things right :( I have over 800 urls and I need to rewrite them to point to a simple pdf file. Currently, I have links to: http://subdomain.mydomain....
Heather Carrigan Valentin's user avatar
0 votes
0 answers
130 views

How to redirect url in htaccess with regex?

My url is changing and for example now it is ..safety-bathroom then is changing to safety-bathroom-1 and so on, to avoid daily changing rule in htaccess I would like to have a rule which will do ...
Rob D. A.'s user avatar
  • 111
1 vote
1 answer
721 views

redirect non-www to www for a specific subfolder only

I am trying to redirect one subfolder of my website to www if its not having www prefix. For example. If user opens example.com/sites it should redirect to www.example.com/sites Also, If user ...
Unnikrishnan's user avatar
  • 1,315
1 vote
0 answers
623 views

Apache redirect for url with multiple query string

I am trying to write a url redirection for a url with multiple query strings. https://www.example.com/site/template/?tab=ab&mediaId=2842247 to NEW URL: https://www.example.com/new-dynamic-...
Unnikrishnan's user avatar
  • 1,315
1 vote
2 answers
4k views

Apache ProxyPass by dynamic hostname

I am trying to configure Apache to proxy to an internal server based on dynamic hostnames and using other ports. It seems to be a little bit too complicated for me. This is what I have: <Location /...
JCS81's user avatar
  • 11
0 votes
1 answer
28 views

Convert If rewrite rule to modrewrite

Please help me to convert below to a modrewrite rule. <If "%{HTTP_HOST} == 'm-dev.domain.com'"> Redirect "/subdomain/page-to-load" "http://m-dev.domain.com/subdomain/page-to-load-mobile" </...
Unnikrishnan's user avatar
  • 1,315
0 votes
0 answers
105 views

rewrite URL with respect to request domain in apache

I want to serve different files when user calls a URL from different domains. For instance, I have a desktop version and mobile version of the website. I want to serve a specific file when user access ...
Unnikrishnan's user avatar
  • 1,315
1 vote
1 answer
2k views

How to proxy requests to a localhost route to a non-local url

I am setting up a local environment for testing using WAMP. The app (angular app) sits in the /wamp/www/app/ directory. It makes requests to another api by sending requests to another route on its ...
Xgongiveittoya's user avatar
1 vote
0 answers
351 views

Cannot load mod_rewrite Apache module

I am trying to use mod_rewrite module of Apache24 server, but I am not being able to load it. I know there have been many questions asked regarding this topic and I have gone through all of them but ...
neophyte's user avatar
  • 111
2 votes
0 answers
2k views

Lighttpd Proxy to Service on Another Port

I have an issue, which I hope is common enough to be resolved quickly. Specifically, I have a server on which I wish to host several web-applications at the same time for my own personal use. I would ...
RedHack's user avatar
  • 490
0 votes
1 answer
3k views

Using Nginx rewrite to change the shown URL from an IP?

I can't find any info on this so I don't know if it's even possible, but I was wondering: Can I use NGINX's rewrite module to change the displayed URL from, for example 123.123.123.123:6000/some/path, ...
Nico Weiss's user avatar
1 vote
0 answers
418 views

How to rename Webdav folder in another

In my server with apache and mod_dav have the following webdav rules in config Alias /admin_folder /var/www/test_site_cloud/web/admin_folder/files so I have /admin_folder mount. Now I need to rename ...
r1si's user avatar
  • 123
1 vote
0 answers
257 views

Rewrite without url changing

I would like to redirect (without url changing) from mysite.com/order/business to mysite.com/order/index.php?tariff=business I have this .htaccess: Options +FollowSymLinks RewriteEngine on ...
i1859302's user avatar
0 votes
1 answer
4k views

.htaccess RewriteRule to redirect all to root

I would like to redirect every request to root by using RewriteRules in my .htaccess file (later on I will copy them to a vhost file). I tried something like this: RewriteRule ^(.*)$ http://test....
Jona Koudijs's user avatar
1 vote
0 answers
126 views

Ubuntu 14.04 Nginx Rewrite rule issue

Problem with nginx mod rewrite. Really appreciate help. I spent hours on that issue Problem with rewriting url. I want rewrite from bangots.eu/?subtopic=highscores bangots.eu/?subtopic=houses to ...
Szmycu's user avatar
  • 11
0 votes
1 answer
125 views

RewriteRule not redirecting to specified URL

Here is my rewrite rule: RewriteRule ^rest/v(?:[0-9.]+)/((?:[A-Za-z]+)/(?:[A-Za-z]+)(?:/(?:[A-Za-z0-9])+))?\.(json)$ https://localhost/rest/v1/index.php?url=$1&type=$2 [QSA,NC,L] It’s something ...
Adam Carter's user avatar
0 votes
1 answer
3k views

Restrict access in apache except for one URL when using "master file" and mod_rewrite

I successfully applied basic authentication to my entire website but now I want to make an exception for a specific URL pattern. From what I understand, I can use the directive but so far, it isn't ...
Craig Silver's user avatar
0 votes
1 answer
5k views

.htaccess file not running and internal server error

I am using ubuntu 14.04 and have LAMP environment. I have one of the project in dir /var/www/html/project1 . It can't access the .htaccess file for rewriting url rules. For that i have to change in /...
Farman Ali's user avatar
0 votes
1 answer
46 views

apache2 RewriteEngine subfolder configuration is not wroking as expected. I am not sure how to correct it

The rewrite engine appears to be "functioning" but not as expected. Here is the dir tree of my public_html folder (serving using apache2 in my userdir) ┌─[admini@linuxbox][~/public_html] │ [13:16:45 ...
CupCakeThief's user avatar
0 votes
2 answers
5k views

Apache http to https redirect with Rewrite

Using Apache 2.4 on OS X Yosemite. Need to modify this virtual host for it to redirect http://server.kibana and http://www.server.kibana to https://server.kibana Here is the Vhost: <VirtualHost *:...
drew1kun's user avatar
  • 2,137
1 vote
1 answer
2k views

URL to filesystem mapping in Apache

I have a blog which is at mysite.tld/blog. Currently mysite.tld redirects to mysite.tld/blog via an index.php in the root. Apparently when I set this up two years back I could not get the .httaccess ...
Jeroen De Dauw's user avatar
1 vote
1 answer
2k views

mod_rewrite path info postfix and per-dir prrefix

There's an issue with .htaccess configuration. I just need the url /category to match the category.php script, but when I try to open this url, there's a 404 error instead. Here's my .htaccess: ...
Alexey Kosov's user avatar
1 vote
1 answer
2k views

Using Apache Httpd mod_rewrite to rewrite URL based on Accept request header?

I'm attempting to rewrite a URL based on the Accept header of the request. I saw in the docs that this seems to be possible, but I couldn't find any details or examples anywhere on how to go about it. ...
Edy Bourne's user avatar
0 votes
1 answer
254 views

Redirect from secure site to non-secure site with wildcard subdomain

I have the following set up in apache2.conf: <Directory /var/www/html> RewriteEngine on RewriteCond %{HTTP_HOST} ^(www\.|)mydomain\.com$ RewriteCond %{SERVER_PORT} !^443$ ...
server_kitten's user avatar
1 vote
1 answer
7k views

Cannot set up mod_rewrite with XAMPP

I'm trying to enable mod_rewrite on a XAMPP 5.6.3 installation. I've been following these guides: http://www.leonardaustin.com/blog/technical/enable-mod_rewrite-in-xampp/ http://www.lancelhoff.com/...
Septagram's user avatar
  • 5,478
0 votes
1 answer
48 views

Using Apache RewriteRule

I'm attempting to get a very simple RewriteRule working in Apache - I've set Apache2 up (in Vagrant) and run sudo a2enmod rewrite successfully (and restarted Apache after), with the following trivial ...
eZanmoto's user avatar
  • 131
2 votes
1 answer
2k views

Reverse proxy 502 bad gateway

I have setup a subdomain to proxy my plesk panel, but when saving pages I am getting 502 Bad Gateway error instead of a completion message. I am running CentOS 6. Here is my vhost.conf configuration ...
Nahydrin's user avatar
  • 445
0 votes
1 answer
68 views

Redirect domain name

I have two domain names pointing to my server. I want them both to serve identical HTML. I thought I would just do the following, however, it was unsuccessful. Note that I eventually will want ssl ...
user1032531's user avatar
  • 1,651
0 votes
2 answers
128 views

apache mod rewrite - how to determine what file on disk is being hit?

A project that I am newly working on has been around for years, and it has managed to accumulate several hundred rather complex RewriteRules within the Apache conf files. When working with some files,...
bguiz's user avatar
  • 2,091
2 votes
0 answers
172 views

Keeping Firefox from adding ".html" to url

I've been messing with .htaccess for a while, and have the following rule: RewriteRule ^(mypage|myotherpage)/?$ main.php?p=$1 [L,QSA] If I enter http://mydomain.com/mypage/, it displays main.php as ...
user1032531's user avatar
  • 1,651
0 votes
2 answers
7k views

The requested URL xxx was not found on this server

I have been tearing my hair on this for hours..please help.. I have been running several websites on localhost for months without a hitch. Unfortunately last week I had do do a fresh instal of ...
user avatar
1 vote
1 answer
2k views

Uploadify with apache authentication

I'm trying to get a webapp working on my server. The app is using uploadify and that is the only part that I now can't get to work. I have a Alias to reach the app : (in /etc/apache2/conf.d/appalias) ...
John Master's user avatar
0 votes
1 answer
1k views

How do I write a rewrite rule for a virtual host in Apache?

I have a subversion server that is working fine; however, I bought a tool that requires that the project have a "branches" subdirectory an is case sensitive. The entire repository already has projects ...
Monso's user avatar
  • 101
0 votes
1 answer
582 views

Block all referer request on Apache

I use my Apache server for a B2B application and I want to block all the referer requests like this one : [Tue Aug 13 14:23:05 2013] [error] [client 74.63.192.51] File does not exist: C:/Program ...
Momo's user avatar
  • 133
1 vote
0 answers
518 views

apache rewrite to different domain subfolder without changing the address in browser url

Actually we have 2 sites. Site 1: Desktop version hosted in [http://mysite1.com] , using Apache server Site2: Mobile version of mysite.com is hosted in [http://mobilesites.com/mysite1mobile] , using ...
Sharat's user avatar
  • 11