Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
1
answers
3013
views
Apache redirect full URL with RewriteRule
I have a redirect problem with 'RewriteRule', i have this in mt .htaccess: RewriteCond %{HTTP_HOST} ^foo.domain.com RewriteRule ^(.*)$ http://www.domain.com/foo/$1 [R=permanent,L] If i go to foo.domain.com redirect to www.domain.com/foo/ and it's ok, instead i go to foo.domain.com/bar i have an erro...
I have a redirect problem with 'RewriteRule', i have this in mt .htaccess:
RewriteCond %{HTTP_HOST} ^foo.domain.com
RewriteRule ^(.*)$ http://www.domain.com/foo/$1 [R=permanent,L]
If i go to foo.domain.com redirect to www.domain.com/foo/ and it's ok, instead i go to foo.domain.com/bar i have an error, must go to www.domain.com/foo/bar.
Where is error?
stecog
(2341 rep)
Oct 3, 2014, 03:57 PM
• Last activity: Jul 29, 2025, 07:10 PM
2
votes
1
answers
4891
views
Redirect Main domain and subdomain from http to https
i want to redirect these sub domains and main domain from http to https and sub blogs too. **Home directories** - WWW (Wordpress): `/home1/placehq5/public_html/.htaccess` - My Somadome (PHP): `/home1/placehq5/public_html/my` - Kiosk site (HTML): `/home1/placehq5/public_html/kiosk` Webserver is Apach...
i want to redirect these sub domains and main domain from http to https and sub blogs too.
**Home directories**
- WWW (Wordpress):
/home1/placehq5/public_html/.htaccess
- My Somadome (PHP): /home1/placehq5/public_html/my
- Kiosk site (HTML): /home1/placehq5/public_html/kiosk
Webserver is Apache version 2.2.31 (on Linux)
please correct this htaccess file.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://somadome.com/$1 [L,R=301]
RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} ^www[.].+$
RewriteRule ^(.*)$ https://somadome.com/$1 [L,R=301]
in this picture first column is how my urls are right now, 2nd column is what i want after htaccess rules, 3rd coulmn is what iam getting after applying these rule below:-

Navdeep.D2
(35 rep)
May 8, 2017, 07:36 PM
• Last activity: Jun 30, 2025, 06:05 PM
1
votes
1
answers
2047
views
Apache query string rewrite not working
I need to rewrite a domain name in a query parameter in order to augment a proxy. The proxy basically is just a domain rewrite, but some of the responses from the upstream server include a query parameter that is eventually used as a redirect (in the "Location" header). I need to be able to rewrite...
I need to rewrite a domain name in a query parameter in order to augment a proxy. The proxy basically is just a domain rewrite, but some of the responses from the upstream server include a query parameter that is eventually used as a redirect (in the "Location" header). I need to be able to rewrite this domain name so that it points to the proxy instead of the upstream server. My current config looks like
SSLEngine On
SSLProxyEngine On
# Set the path to SSL certificate
# Usage: SSLCertificateFile /path/to/cert.pem
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
# Servers to proxy the connection, or;
# List of application servers:
# Usage:
# ProxyPass / http://[IP Addr.]:[port]/
# ProxyPassReverse / http://[IP Addr.]:[port]/
# Example:
RewriteEngine On
LogLevel alert rewrite:trace6
RewriteCond %{QUERY_STRING} (.*)upstream\.com(.*)
RewriteRule (.*)upstream\.com(.*) %1proxy.com%2 [N]
ProxyPass / https://upstream.com/
ProxyPassReverse / https://upstream.com/
The proxy is working fine, but one of the first things the upstream server does is send a redirect with a query parameter that is used for a second redirect, which causes the proxy to lose control of the traffic stream. I need this query string rewritten so the upstream servers response will cause a redirect back to the proxy instead of the upstream server.
mod_rewrite is enabled and 'apachectl -t' reports that the config is OK.
smokes2345
(880 rep)
Nov 17, 2016, 04:54 PM
• Last activity: May 12, 2025, 11:07 PM
0
votes
0
answers
49
views
Help needed with .htaccess
I have a website which needs to be changed from Nginx to Apache webserver. The index directory is `nl.html` but the HTML extension is removed from the address bar. If I visit the website `example.com` it shows in the address bar the following URL: `example.com/nl` but actually it's `nl.html`. At the...
I have a website which needs to be changed from Nginx to Apache webserver.
The index directory is
nl.html
but the HTML extension is removed from the address bar.
If I visit the website example.com
it shows in the address bar the following URL: example.com/nl
but actually it's nl.html
.
At the moment I have the following .htaccess
RewriteEngine On
RewriteCond %{REQUEST_URI} \.html$
RewriteRule ^(.*)\.html$ $1 [R=301,L]
When I visit the website the root URL is shown without the /nl
.
If I visit /nl/blog
it shows a 404 but it should show /nl/blog.html
the issue also appears on other files.
What am I missing here?
Noob
(161 rep)
Jun 25, 2024, 08:07 PM
• Last activity: Jun 25, 2024, 08:52 PM
2
votes
2
answers
2756
views
RewriteRule overrides ProxyPass
On a centos 7 machine, I'd like to run a python server alongside an apache server. I figured the easiest way would be to configure apache as a reverse proxy. This is my VirtualHost configuration: DocumentRoot /home/username/mydomain/src ServerName mydomain.com ErrorLog logs/mydomain-error_log Custom...
On a centos 7 machine, I'd like to run a python server alongside an apache server. I figured the easiest way would be to configure apache as a reverse proxy. This is my VirtualHost configuration:
DocumentRoot /home/username/mydomain/src
ServerName mydomain.com
ErrorLog logs/mydomain-error_log
CustomLog logs/mydomain-access_log common
DirectoryIndex index.php
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
AddOutputFilterByType DEFLATE text/html text/plain text/xml
ProxyPreserveHost On
ProxyPass /mediaproxy http://127.0.0.1:9001/mediaproxy
ProxyPassReverse /mediaproxy http://127.0.0.1:9001/mediaproxy
LogLevel alert rewrite:trace6
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/api/media/(.*) /data/$1 [L]
RewriteRule ^/api/v1/* /api/v1/index.php [L]
RewriteRule ^/assets/(.*) /site/v1/content/assets/$1 [L]
RewriteRule ^/css/(.*) /site/v1/content/css/$1 [L]
RewriteRule ^/js/(.*) /site/v1/content/js/$1 [L]
RewriteRule ^/fonts/(.*) /site/v1/content/fonts/$1 [L]
RewriteRule ^/* /index.php [L] # problematic rule
// lets encrypt entries
Now, my problem is that rewrite rules takes precedence over ProxyPass. That ism when I visit mydomain.com/mediaproxy/somepage, it serves the content at
/index.php
, specified with RewriteRule ^/* /index.php [L]
. Reverse proxy works correctly if I remove the problematic rule. Unfortunately I need to keep it.
How do I tell apache to use ProxyPass
rule first, and use RewriteRule
only if there is no match?
sanjihan
(415 rep)
Aug 4, 2022, 07:51 PM
• Last activity: Aug 10, 2022, 06:59 PM
0
votes
0
answers
318
views
Why does Apache's mod-rewrite module process some GET requests and not process others?
I am trying to get mod_rewrite working. I'm experimenting with a very simple rule: RewriteEngine On RewriteRule ^/one /var/www/html/oldindex.html Here is the complete config file: /etc/apache2/sites-available/govmeeting.org.conf Require all granted ServerName govmeeting.org ServerAlias www.govmeetin...
I am trying to get mod_rewrite working. I'm experimenting with a very simple rule:
RewriteEngine On
RewriteRule ^/one /var/www/html/oldindex.html
Here is the complete config file: /etc/apache2/sites-available/govmeeting.org.conf
Require all granted
ServerName govmeeting.org
ServerAlias www.govmeeting.org
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
LogLevel trace6 rewrite_module:trace8
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine On
RewriteRule ^/one /var/www/html/oldindex.html
I send two requests from the browser for "govmeeting.org/one". "oldindex.html" exists in my DocumentRoot. I see no processing occurring for either in error.log.
However, at about the same time, an external request arrived from someone else. That request DOES get processed, but not mine. Below is the error.log and access.log for this time period. Note that the GET at 23:05:45 and 23:07:04 for "/one" is NOT processed. But the GET at 23:07:06 for "//wp-config.php" is processed.
I have: Server version: Apache/2.4.41 (Ubuntu) Server built: 2021-10-14T16:24:43. The server is running on a VM in Google Compute Engine.
116.179.32.156 - - [05/Dec/2021:22:41:08 +0000] "GET / HTTP/1.1" 200 8945 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36"
67.80.142.21 - - [05/Dec/2021:23:05:45 +0000] "GET /one HTTP/1.1" 404 5729 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36"
67.80.142.21 - - [05/Dec/2021:23:06:05 +0000] "-" 408 5213 "-" "-"
67.80.142.21 - - [05/Dec/2021:23:07:04 +0000] "GET /one HTTP/1.1" 404 1079 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36"
136.144.41.231 - - [05/Dec/2021:23:07:06 +0000] "GET //wp-config.php HTTP/1.1" 404 493 "-" "Mozlila/5.0 (Linux; Android 7.0; SM-G892A Bulid/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/60.0.3112.107 Moblie Safari/537.36"
67.80.142.21 - - [05/Dec/2021:23:07:24 +0000] "-" 408 563 "-" "-"
209.17.97.34 - - [05/Dec/2021:23:11:47 +0000] "GET / HTTP/1.1" 200 4153 "-" "Mozilla/5.0 (compatible; Nimbostratus-Bot/v1.3.2; http://cloudsystemnetworks.com) "
Here is the part of error.log for that time period:
[Sun Dec 05 23:04:26.847532 2021] [mpm_prefork:notice] [pid 17645] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Sun Dec 05 23:04:26.847605 2021] [core:notice] [pid 17645] AH00094: Command line: '/usr/sbin/apache2'
[Sun Dec 05 23:07:06.213591 2021] [core:trace5] [pid 17650] protocol.c(708): [client 136.144.41.231:35566] Request received from client: GET //wp-config.php HTTP/1.1
[Sun Dec 05 23:07:06.213740 2021] [http:trace4] [pid 17650] http_request.c(436): [client 136.144.41.231:35566] Headers received from client:
[Sun Dec 05 23:07:06.213747 2021] [http:trace4] [pid 17650] http_request.c(439): [client 136.144.41.231:35566] Host: govmeeting.org
[Sun Dec 05 23:07:06.213751 2021] [http:trace4] [pid 17650] http_request.c(439): [client 136.144.41.231:35566] User-Agent: Mozlila/5.0 (Linux; Android 7.0; SM-G892A Bulid/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/60.0.3112.107 Moblie Safari/537.36
[Sun Dec 05 23:07:06.213755 2021] [http:trace4] [pid 17650] http_request.c(439): [client 136.144.41.231:35566] Accept-Encoding: gzip, deflate
[Sun Dec 05 23:07:06.213759 2021] [http:trace4] [pid 17650] http_request.c(439): [client 136.144.41.231:35566] Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
[Sun Dec 05 23:07:06.213763 2021] [http:trace4] [pid 17650] http_request.c(439): [client 136.144.41.231:35566] Connection: keep-alive
[Sun Dec 05 23:07:06.213766 2021] [http:trace4] [pid 17650] http_request.c(439): [client 136.144.41.231:35566] Cache-Control: max-age=0
[Sun Dec 05 23:07:06.213770 2021] [http:trace4] [pid 17650] http_request.c(439): [client 136.144.41.231:35566] Upgrade-Insecure-Requests: 1
[Sun Dec 05 23:07:06.213773 2021] [http:trace4] [pid 17650] http_request.c(439): [client 136.144.41.231:35566] Accept-Language: en-US,en;q=0.9,fr;q=0.8
[Sun Dec 05 23:07:06.213803 2021] [rewrite:trace2] [pid 17650] mod_rewrite.c(483): [client 136.144.41.231:35566] 136.144.41.231 - - [govmeeting.org/sid#7fafa63c3810][rid#7fafa64820a0/initial] init rewrite engine with requested uri /wp-config.php
[Sun Dec 05 23:07:06.213809 2021] [rewrite:trace3] [pid 17650] mod_rewrite.c(483): [client 136.144.41.231:35566] 136.144.41.231 - - [govmeeting.org/sid#7fafa63c3810][rid#7fafa64820a0/initial] applying pattern '^/one' to uri '/wp-config.php'
[Sun Dec 05 23:07:06.213821 2021] [rewrite:trace1] [pid 17650] mod_rewrite.c(483): [client 136.144.41.231:35566] 136.144.41.231 - - [govmeeting.org/sid#7fafa63c3810][rid#7fafa64820a0/initial] pass through /wp-config.php
[Sun Dec 05 23:07:06.213922 2021] [authz_core:debug] [pid 17650] mod_authz_core.c(817): [client 136.144.41.231:35566] AH01626: authorization result of Require all granted: granted
[Sun Dec 05 23:07:06.213929 2021] [authz_core:debug] [pid 17650] mod_authz_core.c(817): [client 136.144.41.231:35566] AH01626: authorization result of : granted
[Sun Dec 05 23:07:06.213933 2021] [core:trace3] [pid 17650] request.c(310): [client 136.144.41.231:35566] request authorized without authentication by access_checker_ex hook: /wp-config.php
[Sun Dec 05 23:07:06.214003 2021] [php7:error] [pid 17650] [client 136.144.41.231:35566] script '/var/www/html/wp-config.php' not found or unable to stat
[Sun Dec 05 23:07:06.214051 2021] [http:trace3] [pid 17650] http_filters.c(1125): [client 136.144.41.231:35566] Response sent with status 404, headers:
[Sun Dec 05 23:07:06.214070 2021] [http:trace5] [pid 17650] http_filters.c(1134): [client 136.144.41.231:35566] Date: Sun, 05 Dec 2021 23:07:06 GMT
[Sun Dec 05 23:07:06.214074 2021] [http:trace5] [pid 17650] http_filters.c(1137): [client 136.144.41.231:35566] Server: Apache/2.4.41 (Ubuntu)
[Sun Dec 05 23:07:06.214077 2021] [http:trace4] [pid 17650] http_filters.c(955): [client 136.144.41.231:35566] Content-Length: 276
[Sun Dec 05 23:07:06.214084 2021] [http:trace4] [pid 17650] http_filters.c(955): [client 136.144.41.231:35566] Keep-Alive: timeout=5, max=100
[Sun Dec 05 23:07:06.214087 2021] [http:trace4] [pid 17650] http_filters.c(955): [client 136.144.41.231:35566] Connection: Keep-Alive
[Sun Dec 05 23:07:06.214090 2021] [http:trace4] [pid 17650] http_filters.c(955): [client 136.144.41.231:35566] Content-Type: text/html; charset=iso-8859-1
[Sun Dec 05 23:07:06.214111 2021] [core:trace6] [pid 17650] core_filters.c(519): [client 136.144.41.231:35566] will flush because of FLUSH bucket
[Sun Dec 05 23:07:06.313890 2021] [core:trace6] [pid 17650] core_filters.c(519): [client 136.144.41.231:35566] will flush because of FLUSH bucket
John Pankowicz
(1429 rep)
Dec 6, 2021, 12:15 AM
• Last activity: Dec 6, 2021, 03:00 AM
0
votes
0
answers
864
views
In Apache config all my attempts to redirect all requests to index.html fail
I have an Angular SPA that should only request index.html. All other URL requests to this server are handled internally by the SPA. I want to redirect all 404 errs to index.html. [UPDATE: This post describes how I am trying to use mod_rewrite for this. Perhaps this is not what I should be doing.] I...
I have an Angular SPA that should only request index.html. All other URL requests to this server are handled internally by the SPA. I want to redirect all 404 errs to index.html.
[UPDATE: This post describes how I am trying to use mod_rewrite for this. Perhaps this is not what I should be doing.]
I am new to Apache configuration. Every solution that I found online for this fails. I was able to successfully add a re-write to redirect http traffic to https. So I assume that mod_rewrite should be set up correctly. But all my other attempts at a re-write fail. I am probably making some obvious newbee mistake.
I am runing:
Server version: Apache/2.4.41 (Ubuntu)
Server built: 2021-10-14T16:24:43
After editing the config file, I always run "sudo systemctl reload apache2.
Here is my config file for my virtual host, govmeeting.org.conf:
Require all granted
ServerName govmeeting.org
ServerAlias www.govmeeting.org
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# This re-directs http traffic to https. This works.
RewriteEngine on
RewriteCond %{SERVER_NAME} =govmeeting.org [OR]
RewriteCond %{SERVER_NAME} =www.govmeeting.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
# This was one solution I found to redirect all 404 errs to the main domain.
# It does NOT work. I still get 404 errs for govmeeting.org/somepage.
# ErrorDocument 404 https://govmeeting.org/
# This is another solution that I found that does NOT work:
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule . /index.html [L]
#
# Here is another suggestion that does NOT work:
# RewriteBase /
# RewriteRule ^index\.html$ - [L]
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule . /index.html [L]
#
# In this, I tried to redirect "somepage" to index.html. Does NOT work.
# I tried with and without a second "RewriteEngine on", because the
# suggestion was using it twice.
# RewriteEngine on
# RewriteRule ^somepage$ index.html [NC]
#
# Here I added "/" before each file name. Does NOT work.
# RewriteEngine on
# Redirect /x.html /index.html
UPDATE: I set up logging with:
LogLevel trace6 rewrite_module:trace6
I edited my config to only have this redirect:
RewriteEngine on
RewriteRule ^home.html$ index.html [NC]
I then sent requests from the browser for "govmeeting.org/dashboard", ".../xxx.txt" and ".../home.html".
Here is a tail of access.log:
114.119.156.56 - - [04/Dec/2021:02:03:03 +0000] "GET /robots.txt HTTP/1.1" 404 493 "-" "Mozilla/5.0 (compatible;PetalBot;+https://webmaster.petalsearch.com/site/petalbot) "
67.80.142.21 - - [04/Dec/2021:02:07:48 +0000] "GET /dashboard HTTP/1.1" 404 5729 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36"
67.80.142.21 - - [04/Dec/2021:02:08:08 +0000] "-" 408 5213 "-" "-"
188.166.170.135 - - [04/Dec/2021:02:12:50 +0000] "GET /currentsetting.htm HTTP/1.1" 404 5607 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"
188.166.170.135 - - [04/Dec/2021:02:12:50 +0000] "GET / HTTP/1.0" 400 624 "-" "-"
67.80.142.21 - - [04/Dec/2021:02:19:58 +0000] "GET /xxx.txt HTTP/1.1" 404 5729 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36"
67.80.142.21 - - [04/Dec/2021:02:20:18 +0000] "-" 408 5213 "-" "-"
67.80.142.21 - - [04/Dec/2021:02:25:06 +0000] "GET /home.html HTTP/1.1" 404 5729 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36"
67.80.142.21 - - [04/Dec/2021:02:25:26 +0000] "-" 408 5213 "-" "-"
Here is a tail of error.log. I am not sure how to interpret these results. The contents of the folder for my site only contains an index.html and a group of javascript files. (no "robots.txt", etc). Is it attempting to do a rewrite for these requests?
[Sat Dec 04 02:03:03.013635 2021] [rewrite:trace2] [pid 4283] mod_rewrite.c(483): [client 114.119.156.56:18482] 114.119.156.56 - - [govmeeting.org/sid#7f337385b810][rid#7f337391a0a0/initial] init rewrite engine with requested uri /robots.txt
[Sat Dec 04 02:03:03.013654 2021] [rewrite:trace3] [pid 4283] mod_rewrite.c(483): [client 114.119.156.56:18482] 114.119.156.56 - - [govmeeting.org/sid#7f337385b810][rid#7f337391a0a0/initial] applying pattern '/^home.html$' to uri '/robots.txt'
[Sat Dec 04 02:03:03.013702 2021] [rewrite:trace1] [pid 4283] mod_rewrite.c(483): [client 114.119.156.56:18482] 114.119.156.56 - - [govmeeting.org/sid#7f337385b810][rid#7f337391a0a0/initial] pass through /robots.txt
[Sat Dec 04 02:28:32.122092 2021] [rewrite:trace2] [pid 4566] mod_rewrite.c(483): [client 167.248.133.59:50802] 167.248.133.59 - - [35.211.93.45/sid#7fd23b007810][rid#7fd23ca000a0/initial] init rewrite engine with requested uri /
[Sat Dec 04 02:28:32.122099 2021] [rewrite:trace3] [pid 4566] mod_rewrite.c(483): [client 167.248.133.59:50802] 167.248.133.59 - - [35.211.93.45/sid#7fd23b007810][rid#7fd23ca000a0/initial] applying pattern '^home.html$' to uri '/'
[Sat Dec 04 02:28:32.122175 2021] [rewrite:trace1] [pid 4566] mod_rewrite.c(483): [client 167.248.133.59:50802] 167.248.133.59 - - [35.211.93.45/sid#7fd23b007810][rid#7fd23ca000a0/initial] pass through /
[Sat Dec 04 02:28:32.122306 2021] [rewrite:trace2] [pid 4566] mod_rewrite.c(483): [client 167.248.133.59:50802] 167.248.133.59 - - [35.211.93.45/sid#7fd23b007810][rid#7fd23b1090a0/subreq] init rewrite engine with requested uri /index.html
[Sat Dec 04 02:28:32.122311 2021] [rewrite:trace3] [pid 4566] mod_rewrite.c(483): [client 167.248.133.59:50802] 167.248.133.59 - - [35.211.93.45/sid#7fd23b007810][rid#7fd23b1090a0/subreq] applying pattern '^home.html$' to uri '/index.html'
[Sat Dec 04 02:28:32.122316 2021] [rewrite:trace1] [pid 4566] mod_rewrite.c(483): [client 167.248.133.59:50802] 167.248.133.59 - - [35.211.93.45/sid#7fd23b007810][rid#7fd23b1090a0/subreq] pass through /index.html
[Sat Dec 04 02:28:32.195319 2021] [rewrite:trace2] [pid 4567] mod_rewrite.c(483): [client 167.248.133.59:40432] 167.248.133.59 - - [35.211.93.45/sid#7fd23b007810][rid#7fd23ca000a0/initial] init rewrite engine with requested uri /
[Sat Dec 04 02:28:32.195325 2021] [rewrite:trace3] [pid 4567] mod_rewrite.c(483): [client 167.248.133.59:40432] 167.248.133.59 - - [35.211.93.45/sid#7fd23b007810][rid#7fd23ca000a0/initial] applying pattern '^home.html$' to uri '/'
[Sat Dec 04 02:28:32.195342 2021] [rewrite:trace1] [pid 4567] mod_rewrite.c(483): [client 167.248.133.59:40432] 167.248.133.59 - - [35.211.93.45/sid#7fd23b007810][rid#7fd23ca000a0/initial] pass through /
[Sat Dec 04 02:28:32.195467 2021] [rewrite:trace2] [pid 4567] mod_rewrite.c(483): [client 167.248.133.59:40432] 167.248.133.59 - - [35.211.93.45/sid#7fd23b007810][rid#7fd23b1090a0/subreq] init rewrite engine with requested uri /index.html
[Sat Dec 04 02:28:32.195472 2021] [rewrite:trace3] [pid 4567] mod_rewrite.c(483): [client 167.248.133.59:40432] 167.248.133.59 - - [35.211.93.45/sid#7fd23b007810][rid#7fd23b1090a0/subreq] applying pattern '^home.html$' to uri '/index.html'
[Sat Dec 04 02:28:32.195476 2021] [rewrite:trace1] [pid 4567] mod_rewrite.c(483): [client 167.248.133.59:40432] 167.248.133.59 - - [35.211.93.45/sid#7fd23b007810][rid#7fd23b1090a0/subreq] pass through /index.html
John Pankowicz
(1429 rep)
Dec 2, 2021, 03:55 PM
• Last activity: Dec 4, 2021, 09:35 PM
0
votes
1
answers
43
views
transfer .htaccess rewrite to apache vhost configuration
I am using a script that is called every time a special keyword combination is in query string - on all of my domains that are located on my server. I am using .htaccess files on every domain that have the following lines: ``` RewriteBase / RewriteCond some_conditions_here RewriteRule .* myspecialsc...
I am using a script that is called every time a special keyword combination is in query string - on all of my domains that are located on my server. I am using .htaccess files on every domain that have the following lines:
RewriteBase /
RewriteCond some_conditions_here
RewriteRule .* myspecialscript.php [L,QSA]
Because of I am working sometimes on the rewrite conditions I have to modify all .htaccess of every virtual host. But I have running a server frontend software that allows to include automatically a special part in every virtual host configuration file - so I want to port the rewirte rule above to work in virtual host configuration. But what I have done - I failed. Rewrite conditions are recognized correctly - but rewriting itself fails.
I have tried the following two:
RewriteEngine On
RewriteCond some_conditions_here
RewriteRule ^/(.*) https://%{HTTP_HOST}/myspecialscript.php [L,QSA]
RewriteRule .* myspecialscript.php [L,QSA]
First fails with "...too much redirections...", second one (of course because of missing rewrite base) with error 400.
Of course I added only ONE of the rules at one time - but both fail with errors as above. What is the problem?
df8oe
(1 rep)
Aug 26, 2020, 08:30 AM
• Last activity: Aug 26, 2020, 09:03 AM
0
votes
1
answers
577
views
Apache RewriteCond not matching on `REQUEST_FILENAME` even though file exists?
Trace log: ``` apache_1 | [Wed Nov 20 17:14:43.950796 2019] [rewrite:trace2] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] init rewrite engine with requested uri /css/main.css apache_1 | [Wed Nov 20 17:...
Trace log:
apache_1 | [Wed Nov 20 17:14:43.950796 2019] [rewrite:trace2] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] init rewrite engine with requested uri /css/main.css
apache_1 | [Wed Nov 20 17:14:43.950822 2019] [rewrite:trace3] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] applying pattern '^' to uri '/css/main.css'
apache_1 | [Wed Nov 20 17:14:43.950836 2019] [rewrite:trace4] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] RewriteCond: input='/css/main.css' pattern='-f' => not-matched
apache_1 | [Wed Nov 20 17:14:43.950839 2019] [rewrite:trace3] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] applying pattern '^' to uri '/css/main.css'
apache_1 | [Wed Nov 20 17:14:43.950842 2019] [rewrite:trace2] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] rewrite '/css/main.css' -> '/index.php'
apache_1 | [Wed Nov 20 17:14:43.950845 2019] [rewrite:trace2] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] local path result: /index.php
apache_1 | [Wed Nov 20 17:14:43.950850 2019] [rewrite:trace2] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] prefixed with document_root to /var/www/html/public/index.php
apache_1 | [Wed Nov 20 17:14:43.950852 2019] [rewrite:trace1] [pid 9:tid 140252198749952] mod_rewrite.c(483): [client 172.18.0.1:54078] 172.18.0.1 - - [localhost/sid#7f8f031725e8][rid#7f8f0078a0a0/initial] go-ahead with /var/www/html/public/index.php [OK]
Important bit is:
RewriteCond: input='/css/main.css' pattern='-f' => not-matched
Why is this not finding the file? It is definitely there.
The config has:
DocumentRoot /var/www/html/public/
And the file is located at: /var/www/html/public/css/main.css
.
---
Running strace
on apache I see the following:
apache_1 | [pid 11] poll([{fd=9, events=POLLIN}], 1, 3000
apache_1 | [pid 10] ) = 0 (Timeout)
apache_1 | [pid 10] wait4(-1, 0x7ffd156f4e0c, WNOHANG|WSTOPPED, NULL) = 0
apache_1 | [pid 10] times({tms_utime=2, tms_stime=13, tms_cutime=0, tms_cstime=0}) = 478112492
apache_1 | [pid 10] select(0, NULL, NULL, NULL, {tv_sec=1, tv_usec=0}) = 0 (Timeout)
apache_1 | [pid 10] wait4(-1, 0x7ffd156f4e0c, WNOHANG|WSTOPPED, NULL) = 0
apache_1 | [pid 10] times({tms_utime=2, tms_stime=13, tms_cutime=0, tms_cstime=0}) = 478112592
apache_1 | [pid 10] select(0, NULL, NULL, NULL, {tv_sec=1, tv_usec=0}) = 0 (Timeout)
apache_1 | [pid 10] wait4(-1, 0x7ffd156f4e0c, WNOHANG|WSTOPPED, NULL) = 0
apache_1 | [pid 10] times({tms_utime=2, tms_stime=13, tms_cutime=0, tms_cstime=0}) = 478112692
apache_1 | [pid 10] select(0, NULL, NULL, NULL, {tv_sec=1, tv_usec=0}
apache_1 | [pid 67] [{EPOLLIN, {u32=3893182512, u64=140578172780592}}], 52, -1) = 1
apache_1 | [pid 59] [{EPOLLIN, {u32=3893182512, u64=140578172780592}}], 52, -1) = 1
apache_1 | [pid 67] accept4(3,
apache_1 | [pid 59] accept4(3,
apache_1 | [pid 67] {sa_family=AF_INET, sin_port=htons(42176), sin_addr=inet_addr("172.18.0.1")}, [128->16], SOCK_CLOEXEC) = 16
apache_1 | [pid 59] 0x7fda85ffad30, , SOCK_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
apache_1 | [pid 67] futex(0x7fdae80d3160, FUTEX_WAKE_PRIVATE, 1) = 1
apache_1 | [pid 59] epoll_wait(13,
apache_1 | [pid 67] epoll_wait(13,
apache_1 | [pid 22] ) = 0
apache_1 | [pid 22] futex(0x7fdae80d30e8, FUTEX_WAKE_PRIVATE, 1) = 0
apache_1 | [pid 22] getsockname(16, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("172.18.0.3")}, [128->16]) = 0
apache_1 | [pid 22] fcntl(16, F_GETFL) = 0x2 (flags O_RDWR)
php-main_1 | - - 20/Nov/2019:17:40:08 +0000 "GET /css/main.css" 200
apache_1 | [pid 22] fcntl(16, F_SETFL, O_RDWR|O_NONBLOCK) = 0
apache_1 | [pid 22] read(16, "GET /css/main.css HTTP/1.1\r\nHost"..., 8000) = 90
apache_1 | [pid 22] getpid() = 13
apache_1 | [pid 22] getpid() = 13
apache_1 | [pid 22] getpid() = 13
apache_1 | [pid 22] write(6, "[Wed Nov 20 17:40:08.966703 2019"..., 249[Wed Nov 20 17:40:08.966703 2019] [rewrite:trace2] [pid 13:tid 140578125055744] mod_rewrite.c(483): [client 172.18.0.1:42176] 172.18.0.1 - - [localhost/sid#7fdae7cfe5e8][rid#7fdae43100a0/initial] init rewrite engine with requested uri /css/main.css
apache_1 | ) = 249
apache_1 | [pid 22] getpid() = 13
apache_1 | [pid 22] write(6, "[Wed Nov 20 17:40:08.966779 2019"..., 240[Wed Nov 20 17:40:08.966779 2019] [rewrite:trace3] [pid 13:tid 140578125055744] mod_rewrite.c(483): [client 172.18.0.1:42176] 172.18.0.1 - - [localhost/sid#7fdae7cfe5e8][rid#7fdae43100a0/initial] applying pattern '^' to uri '/css/main.css'
apache_1 | ) = 240
apache_1 | [pid 22] stat("/css/main.css", 0x7fdae534f8d0) = -1 ENOENT (No such file or directory)
apache_1 | [pid 22] getpid() = 13
apache_1 | [pid 22] write(6, "[Wed Nov 20 17:40:08.966875 2019"..., 259[Wed Nov 20 17:40:08.966875 2019] [rewrite:trace4] [pid 13:tid 140578125055744] mod_rewrite.c(483): [client 172.18.0.1:42176] 172.18.0.1 - - [localhost/sid#7fdae7cfe5e8][rid#7fdae43100a0/initial] RewriteCond: input='/css/main.css' pattern='-f' => not-matched
apache_1 | ) = 259
apache_1 | [pid 22] getpid() = 13
apache_1 | [pid 22] write(6, "[Wed Nov 20 17:40:08.966925 2019"..., 240[Wed Nov 20 17:40:08.966925 2019] [rewrite:trace3] [pid 13:tid 140578125055744] mod_rewrite.c(483): [client 172.18.0.1:42176] 172.18.0.1 - - [localhost/sid#7fdae7cfe5e8][rid#7fdae43100a0/initial] applying pattern '^' to uri '/css/main.css'
apache_1 | ) = 240
apache_1 | [pid 22] getpid() = 13
apache_1 | [pid 22] write(6, "[Wed Nov 20 17:40:08.966980 2019"..., 236[Wed Nov 20 17:40:08.966980 2019] [rewrite:trace2] [pid 13:tid 140578125055744] mod_rewrite.c(483): [client 172.18.0.1:42176] 172.18.0.1 - - [localhost/sid#7fdae7cfe5e8][rid#7fdae43100a0/initial] rewrite '/css/main.css' -> '/index.php'
---
**Edit**
Why is Apache trying to read /css/main.css
?? Why is it not using the document root in there
Chris Stryczynski
(6603 rep)
Nov 20, 2019, 05:17 PM
• Last activity: Nov 20, 2019, 06:11 PM
0
votes
1
answers
714
views
Apache RewriteMap with wildcard
We want to migrate multiple domains on new servers. In the first step (though from a SEO point of this is not recommendable) everything has to be redirected to the new domain's root. Later the team wants to have more fine grained redirects (thus the usage for RewriteMaps) I thought of using somethin...
We want to migrate multiple domains on new servers. In the first step (though from a SEO point of this is not recommendable) everything has to be redirected to the new domain's root.
Later the team wants to have more fine grained redirects (thus the usage for RewriteMaps)
I thought of using something like this:
^/(.*) https://www.newdomain.com/
But it seems I am on the wrong track
Sascha
(245 rep)
Jun 7, 2019, 10:16 AM
• Last activity: Jun 7, 2019, 11:06 AM
-1
votes
1
answers
81
views
display a different name from the 'real' URL name
I need to change an incoming http request - for `www.pathfinder.com/T/client/care/login.html` - to look like `www.Theshop/care/login.html` in the "URL" line on the browser. How can this be done with using "URL" re-write? I've tried RewriteEngine on RewriteRule "^www.pathfinder.com/T/clients/care/$"...
I need to change an incoming http request
- for
www.pathfinder.com/T/client/care/login.html
- to look like www.Theshop/care/login.html
in the "URL" line on the browser.
How can this be done with using "URL" re-write?
I've tried
RewriteEngine on
RewriteRule "^www.pathfinder.com/T/clients/care/$" "www.Theshop.com/care/"
but this doesn't seem to work.
john Woodsmall
(1 rep)
May 1, 2019, 08:22 AM
• Last activity: May 1, 2019, 01:46 PM
1
votes
1
answers
283
views
Htaccess - Map dynamic URL query to a static file
I'm trying to map this dynamic query: /wp-admin/admin-ajax.php?action=mymail_form_css to this static file: /wp-admin/mymail_form.css What I've tried so far which doesn't seem to work is this htaccess code in /wp-admin/.htaccess RewriteEngine on RewriteCond %{QUERY_STRING} action=mymail_form_css Rewr...
I'm trying to map this dynamic query:
/wp-admin/admin-ajax.php?action=mymail_form_css
to this static file:
/wp-admin/mymail_form.css
What I've tried so far which doesn't seem to work is this htaccess code in /wp-admin/.htaccess
RewriteEngine on
RewriteCond %{QUERY_STRING} action=mymail_form_css
RewriteRule ^(.*)$ /mymail_form.css [L,R=301]
I've also tried placing that in the site's document root and no go.
I'm doing this for performance reasons. The dynamic query takes an excessive amount of time to generate a small bit of CSS which hardly ever changes.
SelfTaught
(825 rep)
Mar 7, 2015, 05:34 PM
• Last activity: Apr 6, 2019, 01:06 AM
0
votes
1
answers
141
views
mod_rewrite all and if not found
I need to make some rewrite rules, but I doesn't use Apache HTTP for years and little bit confused with rules... Task: 1. rewrite URLs from `http://example.com/test/file.js` to `http://example.com/test/1/file.js` 2. if file `http://example.com/test/1/file.js` is NOT found - return file `http://examp...
I need to make some rewrite rules, but I doesn't use Apache HTTP for years and little bit confused with rules...
Task:
1. rewrite URLs from
http://example.com/test/file.js
to http://example.com/test/1/file.js
2. if file http://example.com/test/1/file.js
is NOT found - return file http://example.com/test/1/index.html
instead;
I suppose - it must looks like this:
AllowOverride All
# if file http://example.com/test/1/file.js found - return it
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/test/1/$1 [L]
# if file http://example.com/test/1/file.js NOT found - return index.html form /1/ subdir
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/test/1/index.html [L]
Content of /test/
:
# ls -l
total 16
drwxr-xr-x 2 root root 4096 Aug 20 10:14 1
-rw-r--r-- 1 root root 6 Aug 20 08:57 index.html
-rw-r--r-- 1 root root 3 Aug 20 10:06 jj.ll
-rw-r--r-- 1 root root 64 Aug 20 08:50 test.html
And /test/1/
:
# ls -l 1
total 12
-rw-r--r-- 1 root root 15 Aug 20 11:02 file.js
-rw-r--r-- 1 root root 13 Aug 20 10:03 index.html
-rw-r--r-- 1 root root 7 Aug 20 10:14 jj.ll
But- if I try to open URL like http://example.com/test/file.js
- I'm getting file http://example.com/test/1/index.html
anyway.
setevoy
(894 rep)
Aug 20, 2015, 11:13 AM
• Last activity: Jul 4, 2018, 06:49 AM
1
votes
0
answers
324
views
Need .htaccess Rewrite Rule To Remove Trailing <br%20/>
I have links that for some reason have a trailing ` ` and I don't know where they are coming from to try and fix them. So I need a general rewrite rule to remove them so the links won't show up as 404's. I am using amazon-linux-ami/2014.09 and my Apache is Apache/2.2.29 (Amazon). This is the origina...
I have links that for some reason have a trailing
from CMS Page Endings -
and I don't know where they are coming from to try and fix them. So I need a general rewrite rule to remove them so the links won't show up as 404's.
I am using amazon-linux-ami/2014.09 and my Apache is Apache/2.2.29 (Amazon).
This is the original link: abc.com/pages.php?pageid=265
Here is what I have tried:
### Strip from CMS Page Endings -
/pages.php?pageid=265
RewriteRule ^/pages\.php\?pageid=([0-9]+)(
)?$ /pages.php?pageid=$1? [R=301,L]
When this rule is used I get this instead.
abc.com/pages.php?pageid=265
What I want is abc.com/pages.php?pageid=265
with the option for the pageid
to be any number.
Since I don't have the reputation I removed the http://www
.
sharingsunshine
(11 rep)
Oct 29, 2014, 08:29 PM
• Last activity: Feb 17, 2017, 11:09 AM
2
votes
1
answers
1188
views
.htaccess rewrite not working?
I have the following virtual host in /etc/apache2/vhosts.d/ip-based_vhosts.conf: ServerAdmin webmaster@test.local ServerName test.local DocumentRoot /home/web/test.net/html ErrorLog /var/log/apache2/test-error.log CustomLog /var/log/apache2/test-access.log combined HostnameLookups Off UseCanonicalNa...
I have the following virtual host in /etc/apache2/vhosts.d/ip-based_vhosts.conf:
ServerAdmin webmaster@test.local
ServerName test.local
DocumentRoot /home/web/test.net/html
ErrorLog /var/log/apache2/test-error.log
CustomLog /var/log/apache2/test-access.log combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Order allow,deny
Allow from all
DirectoryIndex index.php
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/home/web/test.net/html/$1
And in /home/web/test.net/html I have:
**.htacess**
RewriteEngine on
RewriteRule ^(.*)$ index.php [QSA,L]
**index.php**
When I visit http://test.local I get correctly "/" (without quotes).
But when I visit anything else, e.g. http://test.local/abc I get a 404 page instead of "/abc".
How can I solve this to work properly?
george
(123 rep)
Jan 6, 2017, 12:04 AM
• Last activity: Jan 6, 2017, 11:47 AM
1
votes
1
answers
245
views
Can you have two directory rewrite rules in one configuration?
In /etc/httpd/conf.d for custom conf file where you have multiple sites and databases but with different systems installed in non root folders can you declare more than one rewrite rule like below? I am getting errors with xml not being read to install extensions for joomla and not finding it in tmp...
In /etc/httpd/conf.d for custom conf file where you have multiple sites and databases but with different systems installed in non root folders can you declare more than one rewrite rule like below?
I am getting errors with xml not being read to install extensions for joomla and not finding it in tmp folder even though permissions and ownership are correct so think it
must be the conf file settings. I don't use .htaccess. Yet if I install extensions via a system install extension it works.
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} ^/(.*)$
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^index.php [L]
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} ^/(.*)$
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^index.php [L]
cea
(1573 rep)
Nov 10, 2014, 05:42 AM
• Last activity: Oct 3, 2016, 04:26 PM
1
votes
1
answers
387
views
How can I rewrite with apache mod_rewrite an entire directory?
I need this URL/directory `make/lores/some/` to point/map to `login/` I also need to rewrite `.php` extensions to `.html` ### Example When the client types in `example.com/make/lores/some/login.html` the server should `process example.com/login/login.php`. I have a rule below, but the issue is that...
I need this URL/directory
make/lores/some/
to point/map to login/
I also need to rewrite .php
extensions to .html
### Example
When the client types in example.com/make/lores/some/login.html
the server should process example.com/login/login.php
.
I have a rule below, but the issue is that the other files under the login directory ( e.g., /login/images/one.png
etc.) are not handled/rewritten so I end up with a 404 error.
RewriteRule ^(.*)\.htm$ login/index.php [NC]
hey
(243 rep)
Jun 28, 2014, 06:18 PM
• Last activity: Aug 16, 2016, 08:37 AM
0
votes
2
answers
1680
views
VirtualHost with mod rewrite pointing at tomcat application
I am setting up a server running on Ubuntu 14.04. I have apache and tomcat installed with the rewrite module for apache and mod_jk enabled. I have mod_jk properly configured so apache is forwarding the request to the app context correctly. I also have the domain name pointed correctly at the server...
I am setting up a server running on Ubuntu 14.04. I have apache and tomcat installed with the rewrite module for apache and mod_jk enabled. I have mod_jk properly configured so apache is forwarding the request to the app context correctly. I also have the domain name pointed correctly at the server and am able to browse to it. However, I am having issues with my virtual host file. I am attempting to point a domain at the application running within tomcat. Here is what I have currently as a virtual host file.
ServerName www.domain.com
DocumentRoot /var/www/domain
RewriteEngine On
RewriteRule \/$ /context [L]
I have tried many variations of this but have had no luck. Any help to resolve would be most appreciated.
** Update **
I am able to produce a rewrite to a directory named after the tomcat application, in this example
context
in my apache html folder (/var/www/html/context)
. Here is what my virtual host file now looks like :
ServerName www.domain.com
DocumentRoot /var/www/html/context/
Options FollowSymLinks
AllowOverride None
RewriteEngine On
RewriteRule \/$ /context [L]
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
The problem now is it is not rewriting to the tomcat application named context
. So to sum it all up :
http://{{ip_address}}/context
- works like it should and displays the tomcat application
http://domain.com
- redirects me to html content within /var/www/html/context
How can I force the rewrite rule to redirect to the tomcat application name context
? Is there a global setting that will override rewrites and instead of displaying content within apaches html directory to applications mounted with mod_jk?
Thanks in advance for your help.
Mike Croteau
(113 rep)
Jan 16, 2015, 03:43 AM
• Last activity: Aug 13, 2016, 05:33 PM
1
votes
0
answers
1572
views
.htaccess for redirecting an URL with hashtag
I have urls which I need to redirect to another URL. The issue is that the source URLs contain # character. source url: http://www.wawa.com/fr/#/creations/eclairs redirect to : http://www.wawa.fr/fr/patisseries-1 source url: http://www.wawa.com/fr/#/home Redirect to : http://www.wawa.fr/fr/ I have t...
I have urls which I need to redirect to another URL. The issue is that the source URLs contain # character.
source url: http://www.wawa.com/fr/#/creations/eclairs
redirect to : http://www.wawa.fr/fr/patisseries-1
source url: http://www.wawa.com/fr/#/home
Redirect to : http://www.wawa.fr/fr/
I have tried to use redirect 301 but it doesn't seem to work: (just for urls with #). See my code below-
Redirect 301 /fr/#/creations/eclairs http://www.wawa.fr/fr/patisseries-1
scandalous
(197 rep)
Aug 3, 2016, 11:57 AM
• Last activity: Aug 3, 2016, 03:41 PM
0
votes
1
answers
299
views
Apache: rewrite rule with variable data
I need make this redirect to my webserver: `www.hostname.com/path1/path2/123456789` to `www.hostname.com/search?q=123456789` I have inserted this rule to htaccess file: RewriteRule ^/path1/path2/([0-9]+)$ /search?q=$1 [L,R=301] but is doesn't work (the number is a variable).
I need make this redirect to my webserver:
www.hostname.com/path1/path2/123456789
to www.hostname.com/search?q=123456789
I have inserted this rule to htaccess file:
RewriteRule ^/path1/path2/([0-9]+)$ /search?q=$1 [L,R=301]
but is doesn't work (the number is a variable).
Steph
(657 rep)
Mar 12, 2015, 03:41 PM
• Last activity: Jul 1, 2016, 11:36 AM
Showing page 1 of 20 total questions