124 questions from the last 365 days
4
votes
1
answer
64
views
Transforming project into multilingual using .htaccess
I have a task to transform a project that currently works in a single language into a multilingual project.
The current project URL structure looks like this:
www.site.com
www.site.com/contact.php
www....
0
votes
0
answers
87
views
Weird behavior, htaccess work in both ways?
Request https://example.com/ , htacces file :
RewriteEngine On
RewriteRule ^$ /one
RewriteRule ^/one /two [R]
result I get https://example.com/two, remove the slash in the second RewriteRule
...
1
vote
1
answer
74
views
Dynamic WordPress .htaccess subdomains does not work
I am trying to load custom dynamic subdomains to load as specific subfolders on my WordPress site.
Example:
apple.example.com should load the content from example.com/subfolder/apple
apple.example....
0
votes
1
answer
85
views
How to add routes in laravel 12 [closed]
Fresh new installation of Laravel 12
composer create-project --prefer-dist laravel/laravel api
cd api
composer update
sudo chmod -R 775 storage
sudo chown -R www-data:www-data storage
sudo chmod -R ...
0
votes
1
answer
81
views
How to deny access to website resources (JS, Font's, media, etc.) except via/for the same website's HTML pages
So we have a website, www.horsesandgoats.com and this website has a bunch of unique fonts, these are stored in /includes/fonts/ and need to be available for CSS and JS in other folders inside the /...
-1
votes
1
answer
63
views
Using RewriteRule to Server Content from One Page to Another [closed]
I'm using a CMS that doesn't allow me to change URL structure. It's find for 99.9% of my pages, but there are two that I'd like to have specific URLs. RewriteRule directives work for me in my ....
0
votes
1
answer
68
views
Rewrite URL on shared hosting Laravel [closed]
I currently have my Laravel project accessible via the URL:
https://URLXX.com/dev/public/
I’d like to access it directly using:
https://URLXX.com/dev
The same setup should also work for my staging and ...
0
votes
1
answer
55
views
htaccess - rewrite cond/rule for parameters, but keep extra parameters
Current htaccess block :
# redirect "/search/location.php?state=x&city=x&name=x" to "/search/state/city/name/"
RewriteCond %{THE_REQUEST} \s/search/location.php\?state=(.+)&...
0
votes
0
answers
87
views
ERR_TOO_MANY_REDIRECTS htaccess issue?
I have a site on a VPS. It's a combination of static html and a WMPU installation, where I use subsites for categories.
I was working on migrating all static html content to WP pages, and decided to ...
0
votes
0
answers
77
views
Apache RewriteRule works for /test but not for /test/something
I added this specific rule to my .htaccess in / (webroot) within a wordpress install (above wp auto generated code, there is no further interference with later wp settings there):
RewriteRule ^app/my-...
0
votes
0
answers
70
views
How to redirect based on start prefix and add content to the final URL using .htaccess?
I'm gradually restructuring my site's URLs.
I have a group of old URLs with patterns like this:
mt-14_21-28
mt-15_26-hasta-16_04a
mc-01_21-28
lc-07_36-50-y-lc-08_01-03
lc-09_28-36
lc-22_14-71-y-23_01-...
1
vote
0
answers
91
views
Return 410 instead of 404 for deleted language pages
I have a WordPress website.
For each page https://www.sample.com/english-url/, there is a multilanguage page https://www.sample.com/mt/english-url/, and this page also has a localized version of the ...
1
vote
2
answers
93
views
Write GET Variables from URL path in HTACCESS [closed]
I am trying to create a semi-serverless SPA w/ a blog but want to have "RESTful" URLs. I have the following .htaccess commands doing the job--in combination with JavaScript History API; but, ...
1
vote
0
answers
42
views
htaccess subdomains to subfolders redirection error
the following htaccess redirected subdomains to subfolders with same names
subdomain mooga redirected to folder mooga
and we have subfolder blog in mooga
RewriteCond %{HTTP_HOST} ^((?!www\.)[^.]+)\....
0
votes
0
answers
37
views
htaccess rule run on files without folders
the following htaccess rule will redirect files without extension (contact) to (contact.php)
but it also run on folders
I want it to run only on files only and skip running on folders
RewriteEngine on
...
3
votes
2
answers
257
views
If sees environment variable as empty while it is defined in .htaccess
Only thee following directives in the .htaccess file
SetEnvIf _ .* SSS=1
<If "%{ENV:SSS} -eq 1">
Header set MyHeader 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-%{SSS}e'
</If&...
0
votes
0
answers
31
views
Laravel app hosted on cPanel showing raw PHP code instead of executing in live envirnment [duplicate]
I have deployed my Laravel application on a cPanel server under a subdomain. The app is hosted at:
Installer link (working fine): https://sns.sadistributor.com/public/install/
Main link (not working): ...
0
votes
0
answers
76
views
How to prevent direct access to /public folder in shared hosting with .htaccess?
I have a PHP project deployed on shared hosting, and my files are structured like this:
/public_html/
.htaccess
/public/
index.php
...
I want the site to be accessible from:
...
3
votes
1
answer
73
views
htaccess redirect block query string url
I'm working on a WordPress site that was apparently hacked some time ago. The intruder added a redirect plugin and has been happily redirecting traffic to spammy sites for a while. I removed the ...
2
votes
1
answer
65
views
"B" flag for subrequest not working to fix AH10411 - "Rewritten query string contains control characters or spaces"
I pored through search results, and other answers, and asked chatGPT, but nothing seems to work in my specific case.
In my apache error log, I am getting this error:
AH10411: Rewritten query string ...
1
vote
1
answer
75
views
rewrite rules, doc root, and anchors
What I'd like to do is make a directory act as root for a particular application. So resources linked as "/style.css" would actually load from "website.com/forum/style.css".
I have ...
1
vote
1
answer
79
views
How do I make Apache use 308 for DirectorySlash?
I am having an issue with redirects when posting form data to an Apache HTTP Server. When DirectorySlash is enabled, mod_dir is signaling an HTTP 301 to my client, which is causing the HTTP method to ...
3
votes
1
answer
202
views
htaccess block root folder but allow access to list of specified sub folders [closed]
I am trying to create .htaccess rules at the root of a client site to block traffic to a specific subfolder where WordPress is installed.
Here is my structure:
example.com
|--blog
|--.htaccess
|-...
0
votes
1
answer
86
views
Typo3 v12 .htaccess rewrite problem with composer installation
I have a Typo3 v12 installation (not a fresh one, I have to admit, but an upgraded). I have also upgraded the .htaccess file - using the one from
https://raw.githubusercontent.com/TYPO3/typo3/refs/...
0
votes
1
answer
38
views
Adjusting the priority of a RewriteRule between .htaccess and the main config
I have a problem where a RewriteRule in an .htaccess is bypassing authorisation. The same RewriteRule in the server config works, with authorisation, but the one in the .htaccess unfortunately takes ...
0
votes
0
answers
50
views
.htaccess rules giving err too many redirects in php
<IfModule mod_rewrite.c>
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(?:css|js|jpg|gif|png)$ [NC]
RewriteRule ^category/(.*)$/?$ ...
1
vote
0
answers
61
views
php serve file to client
UPDATE – Solution –
<?php
include 'loggercode.php';
$filename = "pages-26-27.pdf";
header("Content-type: application/pdf");
header("Content-Length: "...
0
votes
2
answers
169
views
Use RewriteRule to execute one specific non-PHP file as PHP
I have a single, specific non-PHP file on the server that must be executed as PHP. For the sake of example let's say it's a text file called test.txt and its contents are: <? echo 'hello world'; ?&...
0
votes
0
answers
45
views
htaccess - Execute redirection before checking authorization
My website is divided in 3 parts, one part for PC/APPLE, second part for MOBILE and third part for ADMIN.
I have an htaccess that does the trick to redirect user to PC/APPLE part or to MOBILE part. ...
0
votes
1
answer
65
views
Intermittent 406 Errors on Post, Pages Detected by Site Analyzers, Not Direct Browser Access
"My WordPress site's post pages return intermittent HTTP 406 "Not Acceptable" errors, but ONLY for site analysis/SEO tools (e.g., SEMrush, Ahrefs, GTmetrix). When accessed directly by ...
3
votes
2
answers
65
views
htaccess mod-rewrite automatically
I have this htaccess rewrite rule that's meant to rewrite /index.php?fuse=admin&view=snapin&controller=snapins&plugin=page&v=termsofservice to /termsofservice.html but it's not working ...
1
vote
0
answers
86
views
Laravel returns 404 when deployed to public_html subdirectory (`~username` path)
As the final task of my university practice, we need to deploy our Laravel project to the university server.
When I SSH into the machine, I land in my home directory, which only contains a public_html ...
2
votes
1
answer
35
views
URL rewrite with an unencoded hash (#) character and an encoded space (%20)
I am looking to create a rewrite file (.htaccess) for the National Library of Medicine (NLM) Classification, which uses URLs of this form (https://classification.nlm.nih.gov/schedules/QS#QS%2023) to ...
0
votes
1
answer
52
views
I want to redirect to public folder (url/test/public) without showing the public in the url and .htaccess code is not working
I have hostinger shared hosting plan.
working on laravel project.
For a domain my current file structure is this :
Public_html/
Test/
Public/
.htaccess
Index.html
...
0
votes
1
answer
49
views
Alias domain gets redirected by Wordpress or ends in 404
We have a domain alias.com , which is a CNAME to domain.com .
When we navigate to it (it's a Wordpress site) we get unexpected redirects.
E.g. https://alias.com/ => redirected to https://...
1
vote
1
answer
61
views
SSI (Server Side Includes) different between servers?
I have the following strange situation with SSI (Server Side Includes) in Apache servers:
<!--#if expr="1 < 0" -->
results in FALSE in both servers
<!--#if expr="1<0&...
2
votes
2
answers
98
views
How to correct redirect old links to new one with rewrite mode?
I am unable to correctly set up the code that manages redirects from old URLs to new ones.
I have an old URL (404 error) like this:
https://www.example.com/it/stainless_steel_flues.html
and I would ...
1
vote
0
answers
59
views
PHP .htaccess multilanguage support /testsite/en and /testsite/no to /language/index.php on Windows 11 with Apache
My PHP program needs to support two languages, en and no with .htaccess file setup. I am using Apache installed on Windows 11. When I go to /testsite/en/ I get an error 500.
Folder structure:
C:\...
0
votes
1
answer
53
views
How to pass through Websocket upgrade for Nginx / Passenger?
I have a hosted site where I want to run a Websocket server in node.js.
I use Postman to create a ws connection, which sends a header with “connection: upgrade”, but this is not let through. Instead ...
0
votes
0
answers
33
views
htaccess - No Authentication for file and parameter
thank you for the last mysql help. Now I have an additional challenge.
I am using htaccess to secure part of the admin area. Is there any change to disable the authentication for a special url with ...
0
votes
1
answer
44
views
htaccess RedirectPermanent problem with OVH
I try to make a RedirectPermanent via htaccess file. My website is hosted on OVH.
So, redirection is working with:
RedirectPermanent /what_to_see/ /what-to-see
When but I do a redirection with multi /...
0
votes
0
answers
22
views
trouble to access to database after rewriting url with cfwheels
I'm looking for advices about the rewriting URLs fonction of cfWheels.
I'm running an app on Adobe ColdFusion 2025, cfWheels 2.5.1 and CommandBox
I'm looking for rewriting URLs of the website (...
0
votes
1
answer
57
views
.htaccess only certain RewriteRules stopped working
I am starting to lose it... I had a few ReweiteRules that all worked but suddenly some of them stopped and I can't figure out why. For example:
This works:
/tool/{slug}/{user_code}/{response}/{...
0
votes
1
answer
64
views
CodeIgniter app redirect issue on OpenLiteSpeed server
I've installed a CodeIgniter app on an OpenLiteSpeed server, and although the script installation went smoothly, there appears to be a problem with the .htaccess redirects.
Pages only seem to work ...
0
votes
1
answer
483
views
Setting file MIME type for ./well-known/traffic-advice in Apache or .htaccess
I am trying to setup the serving of ./well-known/traffic-advice, if nothing else to cut the number of 404s and possibly speed-up access for Chrome users.
Setting via .htaccess would be more flexible ...
0
votes
0
answers
38
views
Too many redirects in htaccess
I have two blocks of the base rules in htacccess:
First:
RewriteCond %{HTTP:Accept-Language} ^en [NC]
RewriteCond %{REQUEST_URI} !^/en/ [NC]
RewriteRule ^(.*)$ https://example.com/en/$1 [NC,R=301,L]
...
0
votes
0
answers
100
views
How to make WordPress and a custom application (MVC) coexist on the same website?
I have a website based on Wordpress and my plan is to gradually migrate to a custom web application based on MVC.
This is the structure of my directories:
.
└── home/
├── .env
├── composer....
0
votes
0
answers
30
views
Redirect to a specific page using htaccess on the status code 400
I want to redirect my site to a specific page (Ex: /example-page-400) if the status code received from the server is 400. Actually I am having a drupal site on which SSO login is enabled. In some ...
0
votes
1
answer
146
views
Is it possible to use Apache mod_speling without a 301 redirect? The original URL should be preserved and the file should be served regardless of case
I am using Apache 2.4.37 on a fairly simple server that is just serving images. The human client that requested this service be setup with case insensitivity. Initially I implemented mod_speling like ...
0
votes
0
answers
81
views
Laravel file in storage/uploads/... returns 404 on live server, but works on localhost
I'm deploying a website using Laravel on a server using CWP (Control Web Panel). On localhost, I can access files in storage/uploads/... just fine.
https://example.com/storage/uploads/...