All Questions
Tagged with apache mod-rewrite
17,956
questions
0
votes
1
answer
18
views
Compare two backreferences in RewriteCond
This is the old URI pattern /release-(\w+)/(\w+)/(.*), where first and second regex pattern are always the same, with the following examples:
/release-foo/foo/(.*)
/release-bar/bar/(.*)
etc
They are ...
1
vote
0
answers
19
views
Fixing Apache HTTPD Configuration for Blocking Specific Headers and Custom 403 Error Page
I'm facing an issue in Apache httpd. In the littpd.conf. Inside the rewrite.mod I am blocking requests which have these 3 headers
X-HTTP-METHOD
X-HTTP-Method-Override
X-METHOD-OVERRIDE
And the ...
0
votes
1
answer
39
views
Laravel project inside a legacy one
I'm trying to make a laravel project work inside a legacy site while we work on modernizing the entire code base. I've been able to make it work in my dev computer using valet creating a custom valet ...
2
votes
1
answer
23
views
Redirect default language parameter to root with htaccess
I have been looking for a solution, but only found one similar case without an answer (unfortunately). Although the implementation is working, I am still missing one crucial aspect.
I am running a ...
0
votes
1
answer
40
views
Redirect All URI Requests, Including Folders, to index.php Using .htaccess?
I am trying to configure my .htaccess file to redirect all URI requests, including folders, to index.php. Here is the structure of my root directory:
app
admin
public
index.php
.htaccess
My goal is ...
0
votes
0
answers
56
views
Best way to deny .php in URLs while keeping access to those files through other URLs
Here are two examples of what I would like to do:
Example 1: I have a services.php file. I would like it to be accessible on www.example.com/services. Furthermore, I would like www.example.com/...
0
votes
0
answers
20
views
RewriteRule issue after 5th rule
I am stuck in a viard issue.
I have the below set of RewriteRule configured in httpd.conf for one of my domain.
----
<Directory "/var/www/html/test/">
RewriteEngine On
...
0
votes
0
answers
17
views
Authorizing Access to apache http application using mod_rewrite rules
i am a bit new to apache web server and mod_rewrite .
We are hosting a cgi application on apache web server We are trying to add an authorization check to verify whether the user has access to the ...
0
votes
0
answers
17
views
Error Too many redirects when changed from Apache to Nginx
I have migrated my website from Apache to Nginx. I had issue after migration.
Current .htaccess configuration:
RewriteBase /
RewriteRule ^home$ index.php
RewriteRule ^file/? do.php?id= [QSA]
...
0
votes
0
answers
27
views
Apache mod_rewrite How to strip slash off document root AND all URIs
I have apache-2.4.59 on fedora40 and trying to strip any trailing slash(es) from the root and any other URIs using RewriteCond/RewriteRule in my vhost config. I've tried a dozen different combinations ...
2
votes
1
answer
53
views
.htaccess deny access to all except one specific file
I have this rule in my root .htaccess file:
# DENY ACCESS TO EVERYTHING INSIDE PHP DIRECTORY
RewriteCond %{HTTP_REFERER} !^http://(www\.)?someurl [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?...
0
votes
0
answers
24
views
RewriteRule in .htaccess to Load Files from Subfolders Without Revealing Subfolder Name
Problem Description:
I'm encountering difficulty configuring a RewriteRule in my .htaccess file to internally load files from subfolders within a specific directory without revealing the subfolder ...
0
votes
1
answer
20
views
Rewrite nginx to htaccess
In a nutshell, I have this working nginx rewrite rule:
rewrite ^/stire-(.*)$ /stire.php?url=https://$1;
and I'm trying to port it to Apache. I've tried lots of RewriteRule combinations in the htaccess ...
1
vote
1
answer
45
views
Trying to redirect hotlinked pdf files using RewriteMap in http.conf and RewriteRules in .htaccess
I am trying to redirect external links to pdf files to the html page were the pdf is hosted.
I have updated /etc/apache2/conf.d/includes/pre_main_global.conf, which is an include file for httpd.conf ...
0
votes
0
answers
17
views
Apache RewriteRule redirecting to wrong protocol
So I have an incoming request scenario where I need to read a query string parameter, set a cookie from that parameter, and then strip off the query string. Easy enough and it works. Except that it ...