All Questions
210
questions
0
votes
0
answers
13
views
Apache - How to compress (gzip) only specific calls
I have PHP application served with Apache 2.4
I need the apache to compress (mod_deflate - gzip) calls for specific users. So the application should decides dynamically which calls gets gzipped.
I was ...
0
votes
0
answers
39
views
I want to add a custom 404 to all my URLs following a relevant pattern using .htaccess file
Hello,
Google is currently indexing query string URLs of my website. Google has currently indexed almost 112k URLs that all of are duplicate versions of other URLs causing my website to slow down and ...
1
vote
1
answer
146
views
What determines the name of Apache PHP Handlers?
When configuring an Apache server to use a Handler to run PHP code, I'm familiar with adding a line similar to below in httpd.conf or .htaccess:
AddHandler application/x-httpd-php81 .php
This tells ...
0
votes
0
answers
47
views
How to server index.php from different directory through .htaccess?
I am working on a project which is in Yii2. I have to integrate swagger UI for API documentation. My current directory structure:
This is what the .htaccess looks like:
RewriteEngine on
RewriteCond %{...
0
votes
0
answers
158
views
$_POST is empty when obtaining in "ErrorDocument 404" (nginx + apache + mod_php)
I try to transfer website from old server to new, and stucked with one problem. PHP/JS code on both servers is the same, but on new server it is not working - $_POST data are empty in AJAX-request.
...
0
votes
0
answers
152
views
URL Shows 404 but adding .php at the end displays
I have set up this website and it's working perfectly, however, extensions such as domain.com/dashboard will display a 404 but when I add .PHP at the back -> domain.com/dashboard.php it displays. ...
0
votes
2
answers
588
views
How to block potential attackers on my server
To keep it brief and simple, I will go straight to the point. It seems a bunch of ip adresses are trying to access files that have potential of containing sensitive server information on my website ...
1
vote
1
answer
991
views
.htaccess Remove first php url parameter if second exist
This is my .htaccess code:
RewriteCond %{REQUEST_URI} !^/pages/ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)(/([^/]+))? pages.php?PAGE=$1&LINK=$...
2
votes
1
answer
737
views
used colons for url htaccess http://localhost/1:1
I have a problem with the colons used in url
this my url
http://localhost/1:1
this my htaccess
RewriteEngine On
RewriteRule ^/(.*):(.*) index.php/$1:$2
this error show Forbidden You don't have ...
0
votes
1
answer
42
views
How to redirect search.php?query=test&search=1&s=1 to /query/test
I have tried other things, but I cannnot get it to work, when I go to the main website, (index.php is just a include of search.php) it will send me to this /query/search.php/search.php/search.php/...
1
vote
1
answer
45
views
PHP processing pages for forms not following line with rest of files
I'm a web developer hobbyist. I'm over 50, never had a true web dev job but like to tinker in my spare time for fun. That said, I have a web site hosted by Bluehost that I wrote with PHP from scratch. ...
1
vote
1
answer
2k
views
CORS conflict after enabling FPM in PHP
In the .htaccess file on my web server, I have the following CORS header set:
Header set Access-Control-Allow-Origin "example.com"
In one of my PHP scripts, that I frequently call while ...
0
votes
3
answers
3k
views
How to tell .htaccess to only allow requests to index.php and app/dist/* folder?
This is the current folder:
/app
/dist
/index.html
/index.css
/index.js
/src
/configurations.json
/index.php
/configurations.php
I have sensitive data everywhere:
app/src/...
/......
1
vote
1
answer
2k
views
.htaccess issue php $_SERVER['PATH_INFO'] is empty [closed]
On local host I was running my php (MVC) application with following rules in my .htaccess file:
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-...
2
votes
1
answer
7k
views
(proxy_fcgi:error) AH01071: Got error 'Unable to open primary script:' (No such file or directory)
X-post from StackOverflow
I've read countless forum posts about this but none of the answers seem to help my situation. Here's the log excerpt:
[proxy_fcgi:error] [pid XXXX] [client redacted] ...
1
vote
1
answer
1k
views
.htaccess write commands if hostname equals to
It is possible write any kind of condition (IF) in .htaccess to apply some specific actions ?
#if hostname = xxx then
php_flag display_errors on
php_flag display_startup_errors ...
2
votes
1
answer
3k
views
Get variables become inaccessible after htaccess rewrite
I'm trying to work with SEO friendly urls and as a result am using htaccess to redirect to a more friendly destination. However, when I do these redirects, I am no longer able to access the get ...
0
votes
0
answers
242
views
SAFARI error white page with symfony and htaccess with php-fpm all work on chrome,IE, firefox
I have a problem i just finish and upload my site but he not work with safari got white page i check log
[Thu May 16 07:56:17.534196 2019] [authz_core:debug] [pid 5671] mod_authz_core.c(820): [client ...
1
vote
0
answers
892
views
Apache appears to be ignoring my .htaccess file, despite mod_rewrite being enabled and AllowOveride all
System specifications:
Amazon Linux AMI release 2017.03
Apache/2.4.33 (Amazon)
PHP 5.6.36
DNS is handled by Cloudflare
Here are my VirtualHosts:
<VirtualHost *:80>
DocumentRoot "/var/www/...
4
votes
1
answer
11k
views
AddType application/x-httpd-php .html stopped working
I have the following line in .htaccess
AddType application/x-httpd-php .html .htm
And it used to work for years to treat html pages as php, however recently I noticed it is not working anymore, ...
1
vote
1
answer
987
views
RewriteRule is not working when index.php is clicked
RewriteRule is not working when index.php is clicked. Below is my code :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^home$ /index.php [L]
...
2
votes
1
answer
2k
views
Multiple RewriteRule in htaccess not working
I am very well aware that such type questions have already been asked many times but I think mine is a different one. I am a newbee to .htaccess.
RewriteEngine On
RewriteBase /
RewriteCond %{...
0
votes
0
answers
15
views
Conflicts between htaccess rules [duplicate]
I'm trying to use the url_rewrite system for php but, as i'm a rookie i have a conflict problem (i suppose) between rules.
I have these three htaccess rules. The first two are working, the last one ...
0
votes
2
answers
1k
views
Using deny from all inside htaccess in a subdomain restrict access to itself
I am facing a strange situation where i couldn't find a proper answer to.
I am using some kind of an API where i can send responses to certain requests from the same root domain.
My api is in a ...
1
vote
0
answers
397
views
Trying to update PHP servers to PHP7-cgi (7.2)
I'm Trying to update PHP servers to php7-cgi (7.2) in my .htaccess file. Just not sure how exactly to edit the code, haven't been able to get it to work.
Here is the code in the .htaccess file:
...
1
vote
1
answer
3k
views
Error 403 (access denied) with updated .htaccess file
Im using a plugin for one of my websites which I have updated recently. Since I have updated I get always an access denied message (Error 403) when opening magnalister.php of the plugin.
When I ...
1
vote
1
answer
1k
views
Finding the source of a 301 redirect (through .htaccess or wp_redirect()
One of my interns applied a 301 redirect on one of the site's pages (domain.com/nice-page) to another page (domain.com/pretty-page) and I'd like to remove that redirect.
The problem is that he is ...
0
votes
1
answer
484
views
Phpmyadmin setup "allow from" and ".htaccess password" not working together
Im following this tutorial from digitalocean and i have sucessfully setup the require ip and allow ip so that only my ip address can connect to the webpage.
However, on the last part setting up the ...
1
vote
1
answer
432
views
PHP + mod_fastcgi + suexec can't read vars set via SetEnv in .htaccess
We have PHP running via mod_fastcgi + suexec and it seems that PHP processes run this way don't see environment variables set via SetEnv in a .htaccess file. I checked via a perl script and a shell ...
1
vote
1
answer
70
views
PHP Dynamically generating redirects
I've recently moved all my of my rules from a .htacess file into a .conf file. Now when I want to add a redirect rule to my website I have to edit the .conf file and sudo apachectl graceful.
I've ...
3
votes
1
answer
7k
views
How to block website for all countries except US and Canada
I have a website which is only for US and Canada visitors. I don't want to make it visible to other visitors.
I want to use Geo targeting solution but I have a amazon hosting it did return current ...
0
votes
1
answer
310
views
Multi-User Server ; Basic Authentication ; User 1 Can Access User 2s Folder After Logging In To His Own and Backtracking
I have an Apache 2.4 server running with PHP and MySQL included. I have pages that are restricted (or are supposed to be) to certain users only. Each user has their own restricted page and must supply ...
4
votes
1
answer
3k
views
Nginx: config set up to make extensionless php pages work
I am trying to set up my first website with nginx and I cannot seem to make extensionless php pages to work.
I would like my pages like /aboutme.php to appear as /aboutme or I would like to just ...
1
vote
1
answer
948
views
How to downgrade PHP to version 5.5 from .htaccess
I had previously PHP 5.5 installed on my Ubuntu VPS and I upgraded to PHP7.1 by install PHP 7.1, Disabling the php5.5 and enabling the php7.1 module.
Its working fine but I want to run php5.5 in some ...
1
vote
1
answer
745
views
Apache2 give access to specific locations (.htaccess file)
Could someone help me with making a .htaccess file or how can i limit access to specific locations.
All my user accessible files are located in /var/www/website however I also have some more folders ...
1
vote
1
answer
2k
views
Why HTACCESS RewriteCond %{HTTP_COOKIE} only for php and not working for html?
I was trying to redirect all direct access in my subfolder using this code
RewriteEngine on
RewriteCond %{HTTP_COOKIE} !user_cookie=[^;]
RewriteRule .* http://webhost.org/ [R=301,L]
I realise it ...
0
votes
1
answer
385
views
is it a security risk to have php files with config in the public folder?
There is a config.php in my root folder.
Users can access domain.com/config.php
However the file does not echo/print any of the config.
Do I still need to deny in some .htaccess rule, or is it safe as ...
0
votes
1
answer
1k
views
Custom 401 error page served by Apache for firefox by not IE or Chrome Kerberos Authorization
I have a Intranet site that is using Kerberos Authentication. I am having issues when the user is not allowed access
In Firefox the ErrorDocument 401 set in .htaccess works but in IE/EDGE/CHROME you ...
0
votes
1
answer
2k
views
How do I find where the 301 redirect is for this error loop?
I am getting redirect loop / endless chain and I cannot figure it out. I'm very new to programming and servers so please help someone very green! Here is what I have so far:
.htaccess
<IfModule ...
3
votes
0
answers
710
views
php_value overrides with Apache using a front controller
I am trying to set specific server side value for virtual paths used to upload files.
All my URLs are virtual and requested are dispatched by a front controller. I have the following config in my ...
2
votes
1
answer
482
views
.htaccess file redirects to wrong destination
I have a LAMP stack. I'm using the following .htaccess file to automatically map requests to .php files:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
So if I browse to ...
0
votes
1
answer
3k
views
HTML5 wont process/parse as PHP7/PHP
So i had to reconfigure my linux server because i migrated it to another system and decided to set it up from scratch just for fun and practice. Only issue is that now my LAMP is running with PHP7 ...
1
vote
1
answer
2k
views
Trouble with htaccess multiple rewrite rules
I have a below criteria
If a query string matches Microwave_Ovens text I need to replace with Microwave-Ovens (replace underscore by hyphen) in Request URI.
It is working as expected for the first ...
1
vote
2
answers
83
views
HTTPS redirect failing for some URLs but not others
Redirection from HTTP to HTTPS happens correctly when the URL is any of the following:
http://example.com >> https://example.com [OK]
http://www.example.com >> https://example.com [OK]
http://www....
2
votes
1
answer
299
views
Pretty URL server side configuration?
I have transferred a website to our new VPS. It worked fine on the old server. I think I know what is causing the problem but don't know where to fix it.
I've read a lot of the posts about pretty ...
1
vote
1
answer
138
views
.htaccess and php configuration
I'm having some trouble to get the right config for .htaccess file.
I made a small site using mvc pattern and all urls look like site.com/appname/public/index.php?param=page. I'm trying to get all ...
1
vote
1
answer
3k
views
How to allow to change php version via .htaccess in Apache?
I've a Centos 7 with Apache, I want to compile php 7.0 and 5.6 and configure that as PHP-FPM.
How can I configure Apache to allow users to change php version using .htaccess?
Example .htaccess entry:
...
2
votes
2
answers
4k
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
1
answer
114
views
How to rewrite a user from a non rewritten url to a rewritten url
I have two URLs. One looks like this way (which is a non rewritten URL):
www.example.com/article.php?id=12
And the next one is looks like this (which is a rewritten URL):
www.example.com/article/12
...
3
votes
1
answer
14k
views
Changing session.save_path in php.ini not working
Fedora 25 + PHP 7 + Apache 2.4.23
Hello, after I change session.save_path in php.ini and restart apache, I can successfully verify that it's modified with:
$ php -i | grep session.save_path
However,...