Questions tagged [mod-rewrite]
The mod-rewrite tag has no usage guidance.
65
questions
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) ...
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 ...
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
...
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 ...
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
...
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 %{...
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 ...
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 ...
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]+)/...
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 ...
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 ...
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 ...
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} ...
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:...
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 ...
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....
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 ...
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 ...
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-...
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 /...
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"
</...
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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
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
...
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....
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 ...
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 ...
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 ...
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 /...
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 ...
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 *:...
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 ...
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:
...
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.
...
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$
...
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/...
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 ...
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 ...
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 ...
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,...
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 ...
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 ...
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)
...
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 ...
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 ...
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 ...