All Questions
Tagged with regex mod-rewrite
3,756
questions
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
1
answer
48
views
mod rewrite split and replace
I need an internal redirect, where category-slug is a dynamic value,
that schould be appended after the ~
/category/**category-slug** /blog/?ucterms=category~**category-slug**
Is that possible with ...
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} ^/...
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 ...
2
votes
2
answers
76
views
Need apache regex config for rewrite rule
Here is a scenario of what I am trying to do.
Folder A has folders B and C.
Folder B has D, E and index.html.
Folder C has index.html
I declared folder B as my DocumentRoot. Declared an Alias for ...
2
votes
1
answer
213
views
Bitnami Apache rewrite Rewrite Cond and Rule
I would really appreciate some help in rewriting something.
I have moved a site to a sub domain and now the links to that site are not working.
The link before was:
https://www.domainname.com/folder/...
0
votes
1
answer
99
views
htaccess rewrite condition 404 all querystring only on index page
i was trying to protect the main page because on google console my report on a querystring is visible like this example:
https://example.com/?s=something.g
i would like to 404 all querystring only on ...
0
votes
1
answer
71
views
Apache rewrite with GET parameters not working
I have a url: www.example.com/products.php?category=category
that I want to rewrite to www.example.com/products/category
(the category can be either meats, condiments or smokers depending on which ...
0
votes
2
answers
39
views
Redirect in .htaccess based on ID (lower / greater) present in the URL
I'm struggling with a redirect that at the beginning seamed to me as simple but it is not. I want to do a redirect in .htaccess file based on the numerical ID present in the input URL.
Ex. https://...
1
vote
1
answer
27
views
Problem with htaccess rewrite rule for seo friendly url
After a month of trying, I couldn't solve the problem:
I am trying to redirect this url:
https://www.example.com/news.php?post=hello-world
to this url:
https://www.example.com/news/hello-world
my ...
1
vote
1
answer
38
views
How to mod_rewrite to redirect specific string length?
Here is what i'm trying to do : when someone access my site using a fixed 32 char string 'folder', it will redirect for a specific site passing this string as parameter
For instance :
www.example.com/...
1
vote
1
answer
70
views
How can I change slash (/) to hyphen in .htaccess file
I have only using php and mysql in my website. I faced problem GET URL change slash to hyphen but not get data.
This is my .htaccess file code
RewriteRule ^list/(.*)/(.*)/$ /list.php?name=$1&date=$...
0
votes
2
answers
63
views
Regex to match url with and without slash
We have this regex in our .htaccess
RewriteRule ^([^\.]+)$ $1.html
It matchs urls like: https://example.com/lib
to a file called lib.html
We need it to also match: https://example.com/lib/
to the ...