Questions tagged [rewritecond]
132 questions
0
votes
0 answers
Issue in showing Apache ErrorDocument based on HTTP_USER_AGENT and REMOTE_ADDR
I need to restrict access to application based on ip address and need to block displaying page if it is opened other than chrome.
Now i can able to restrict ip,
But if i put the browser checking option, then instead of ip address checking, browser…

java_mechanic
- 1
- 1
0
votes
1 answer
Is it possible to access a modified query string in a RewriteCond *after* applying a RewriteRule?
Is it possible to access a modified query string in a RewriteCond after applying a RewriteRule?
What I'm trying is to apply ...
RewriteCond %{QUERY_STRING} ^(.*)&?id=([^&]+)&?(.*)$ [NC]
RewriteRule ^/app\.jsp$ /app/%2?%1%3 [R=302]
... to rewrite…

user27772
- 111
- 2
0
votes
0 answers
Language based RewriteRule like mysite.com/en/ in .htaccess
I'm trying to write redirect directives in the .htaccess to forward internally all user requests like this:
Every request in a language folder should redirect to the requested file with the language query string:
example.com/en/contact.php ->…

denoise
- 53
- 6
0
votes
0 answers
Exclusion in Rewrite Rule
I have a rule in .htaccess redirecting all HTTP requests to HTTPS.
I need to exclude two specific paths because they are called by a legacy application to download a file, connecting using TLS 1.0 (which is not supported by the web server…

RadioLontra
- 1
- 1
0
votes
1 answer
Configuring www.domain.com and domain.com with zonefile or letsencrypt to always forward to domain.com
I have a example that should always result in https://example.com, even when the user is entering www.example.com, https or not.
Ideally, the automated letsencrypt config https config file should work.
I have tried to remove the A-record for www…

uncovery
- 305
- 5
- 14
0
votes
1 answer
apache .htaccess redirecting on one link, but not the other
I have this .htaccess file (this was the one that came with laravel. The only changes I made were to force https in the URL and the code shown below:
Options -MultiViews -Indexes
…
-1
votes
1 answer
Block Wildcard User-agent
how can i write rewrite condition for wildcard user agents
here is the code I'm trying but doesnt work
RewriteCond %{HTTP_USER_AGENT} !*uTorrent* [NC]
RewriteCond %{HTTP_USER_AGENT} !*BitTorrent* [NC]
RewriteCond %{HTTP_USER_AGENT}…

Niresh
- 103
- 4
-1
votes
1 answer
Apache rewrite rule infinite loop for subpage
I am trying to redirect toast.allthesmarts.com to toast.allthesmarts.com/dayone
RewriteEngine on
RewriteCond %{HTTP_HOST} toast.allthesmarts.com
RewriteRule ^(.*)$ http://toast.allthesmarts.com/dayone/ [L,R,QSA]
But this gives me infinite loop.…

Stewie
- 577
- 2
- 7
- 17
-2
votes
1 answer
how would i create rule for a particular subdomain in uppercase? e.g XX.test.com
I am new to system admin side.
I need to create one subdomain with capital letters.
e.g our main URL will be test.com and one of our sub-domain will be SS
then instead of writing ss.test.com I want it to make SS.test.com
how would I achieve…

user4988384
- 1
- 2
-2
votes
1 answer
apache: prepend a string literal to a TestString in a RewriteCond for mod_rewrite
So I can clearly do this:
RewriteCond %{REQUEST_FILENAME}\.php -f
But I cannot do this:
RewriteCond some_directory/%{REQUEST_FILENAME}\.php -f
Furthermore, this also fails:
RewriteCond prefix%{REQUEST_FILENAME} -f
Presuming of course those files…

user535759
- 107
- 4
-2
votes
2 answers
Mod Rewrite code with out changing the url in address bar
I When I call http://www.mysite.in/abc/xyz it shoud show up http://www.mysite.in/abc/xyz/index.php but the url shout not change in address bar and it should work with out "/" in the address. Please any one help me with .htaccess code for apache…

Sreekanth Sagar
- 49
- 1
- 14
-3
votes
2 answers
Apache redirect to parent folder
I have a server pointing to
DocumentRoot /var/www/mysite
I would like to redirect all requests from
/var/www/mysite/folder/
to
/var/www/mysite/
I tried the following:
`RedirectMatch 301 /mysite/folder/(.*)…

Guillaume Renoult
- 101
- 1
- 5