All Questions
4,760
questions
1
vote
1
answer
39
views
How to redirect an url with a specific folder to another, whatever the page?
I tried for hours to redirect in an htaccess every pages of a folder to new url, matching the folder but it seems I definitely do not understand nothing to regex and redirect !
I want to redirect any ...
2
votes
1
answer
30
views
How to rewrite the url using .htaccess file?
I designed a website where I am fetching data from database and I want to create a user friendly url dynamically using .htaccess file. My url type is like
https://example.com/lrc.php?ti=Down+Bad&...
1
vote
1
answer
28
views
htaccess regex: How to avoid multiple redirects and still satisfy 2x2x2 no-duplicate Google requirements
It's strange but there was no such question yet: Each of the following rewrites is trivial when coded separate; but how to construct regex(es) to have all of them in a single rewrite?
http -> ...
1
vote
0
answers
28
views
htaccess rewriting a url to remove .php and to set a single variable as the end page not working
I am trying to get the following:
homepage.com/course-outline.php?training=az-104t00---microsoft-azure-administrator
To resolve to ideally something like this:
homepage.com/course-outline/az-104t00---...
2
votes
1
answer
56
views
Special access rule in an .htaccess file for IP addresses, authorized only for one directory structure
I have been dealing with WordPress for many years, but have a delicate problem with an access rule that I want to store in .htaccess. I use actually Apache 2.4.56.
Initial situation 1: The web server ...
1
vote
1
answer
72
views
How to ignore case in regexp mapping in a .htaccess rewrite rule? [duplicate]
What I have now is the following:
RewriteRule ^([^/]+)/*$ x/$1.html [L,NC,END]
This would point:
/abcd to x/abcd.html
/ABCD to x/ABCD.html
which would not be fine on a Unix file system that is ...
0
votes
0
answers
156
views
htaccess config to serve jxl / avif if file exist
I want to configure the htaccess file on a wordpress installation / apache server to serve a JpegXL if the browser supports it and if not serve a .avif file. If both formats are not supported serve ...
0
votes
2
answers
49
views
Why is my .htaccess redirect not working? RedirectMatch 301 "^news\/[0-9]+-(.*)" "headlines\/$1" [L,R=302]
My .htaccess redirect isn't working.
Here is my RegEx
RedirectMatch 301 "^news\/[0-9]+-(.*)" "headlines\/$1" [L,R=302]
I used this site to generate it and it all seems to work on ...
0
votes
1
answer
38
views
htaccess rewriting wrong
I need to rewrite the following urls:
https://example.com/@example_user/ (with or without end slash) to https://example.com/main.php?user=example_user
And https://example.com/@example_user/config/ (...
2
votes
5
answers
78
views
Same regular expression to get 1 or 2 parts of filename
Can anyone help me please?
It is for mod-rewrite in .htaccess
From this url file name:
car-audi-tt-2
I need to get the full string.
But if the string i get is this:
car-audi-tt-2-2019
I need to ...
2
votes
2
answers
64
views
htaccess - rewriting API requests to "api.php" and other requests to "web.php"
I'm testing some stuffs on Apache server and PHP. at the root of my project, I have this
.htaccess configuration file:
RewriteEngine On
RewriteBase /react/
# API requests
RewriteCond %{REQUEST_URI} ^/...
0
votes
1
answer
96
views
Why doesn't my PHP blocking .htaccess rule work?
I'm using Apache and I have this .htaccess file:
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/...
2
votes
1
answer
51
views
how to accept only 1 forward slash in htaccess?
I have a regex RewriteRule like this:
RewriteRule ^([a-z]+)/$ index.php?lang=$1 [L,QSA]
and I can access the URL like this:
/en/ (expected result)
/en////////////// (I don't want to match ...
0
votes
1
answer
20
views
Redirect with end string anchor not working - why not?
I want to redirect visitors to my monthly Events calendar page (/optredens/maand/) to January (/optredens/maand/2023-01/), because December (/optredens/maand/2023-12/) is empty. Since /optredens/maand/...
-1
votes
1
answer
45
views
I need to rewrite url with regex in .htaccess file for cra web app
I was create an app with create-react-app. Set all routes with react router dom v6. These are all English pathnames but I need to convert them to Turkish. I used regex rewrite like this
Options -...