Questions tagged [.htaccess]

20792 questions
0

votes
0

answer
2

Views

Browser cache of index.html file

I have a CRM app. It's created in angular so when I change something in scripts it creates new index.html file with reference to new js files (with different hashes). But some browsers seem to cache index.html file, so clients still have old version. I have those headers: Cache-Control => max-age=0,...
piernik
1

votes
1

answer
91

Views

Next.JS - `.htaccess` file?

I'm just starting out with my first Next.JS app. I've used npx create-next-app and have made a few pages, when I realized that I'm not sure how to use a .htaccess file. I'm used to Apache taking care of this stuff for me, and simply putting my .htaccess file into my Next.JS app's root directory unsu...
APixel Visuals
1

votes
1

answer
22

Views

.htaccess Doesn't Work for The Second Variable

I'm sorry but I'm not really good in Htaccess and PHP I try to redirect php parameter and it's working fine. Then I try to rewrite the URL in htaccess but only the first variable works. Here my PHP (Working fine): $mobile = $_GET['p']; $text = $_GET['t']; header('Location: https://api.whatsapp.com...
Syafiq Zainal
-1

votes
0

answer
15

Views

why $_GET empty in .htaccess RewriteRule seo url?

i will call url https://www.mrwebzone.com/demo/product/as .htaccess RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico|sitemap\.xml) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^\.]+)$ $1.php [NC,L] Rewrite...
umesh bhanderi
0

votes
0

answer
3

Views

Create beta subdomain to my main site with these parameters below

I want to redirect (beta.mysite.com) subdomain, which is on another server (I only changed the DNS A record) to my main domain site, but would like to send with parameters like mysite.com?beta=1, and keep the subdomain url like beta.mysite.com. On the main site I'd like to check the url (with get me...
tpaiDev
-4

votes
3

answer
139

Views

.htaccess code showing 500 internal error

Hi there I'm trying to make a blog demo and I'm having some pretty URL codes already. i am having a url www.xyz.com and a search url www.xyz.com/search/this+is+a+search+text in search url the parameter search is a page name and this+is+a+search+text is a parameter that i'll be parsing I'm having a ....
Akshay Shrivastav
0

votes
0

answer
3

Views

Permalink structure shows question mark

I have made a site with a front controller in PHP, but I have some problems with the URL and permalinks. When I call a page to show a list of buildings (I use the word byggnader which is swedish for buildings) , I don't get a clean permalink like this: /byggnader/ Despite settings in the .htaccess f...
3D-kreativ
1

votes
1

answer
3.4k

Views

Using htaccess to redirect a directory, but not the files in it

On my website, I've got a directory /folder with some images and html in it. I want to redirect users who try to access http://domain.com/folder to http://domain.com/ but don't want requests for the files in that directory to redirect to http://domain.com/ either. When I try Redirect /folder http://...
saikofish
0

votes
0

answer
6

Views

How to fix ''The requested URL /" in wordpress?

I install my wordpress site in a vps server, only the homepage is worked well but all the others pages don't work , I know the problem is in htacces and try many time to fix this error but always I get a 404 'The requested URL /page was not found on this server.' How I can fix it I tried all this bu...
ahmed guesmi
1

votes
2

answer
2.6k

Views

.htaccess remember passwords [duplicate]

Possible Duplicate: HTTP authentication logout via PHP I’m using .htaccess (and .htpasswd) to protect a folder in my website. This works fine, when I login for the first time, from any computer, I’ve been requested to enter the login and the password in order to access to the protected folder....
blsn
1

votes
0

answer
293

Views

The requested URL … was not found on this server

The home page of my wordpress website seems to be wroking correctly but if you click through to any of the other pages I get the following error message: The requested URL /about was not found on this server. There is following htaccess code in the permalink setting: RewriteEngine On RewriteBase / R...
Sanjeev Thakur
1

votes
2

answer
102

Views

Force site to HTTPS except for some pages and Facebook crawler

There are a few similar questions to this, but none really covered everything I need to do and I'm a bit over my head! I have an existing wordpress site. I want to force the home page and any new subpages to HTTPS but force existing subpages (about 20 of them) to HTTP. Reason being these subpages ha...
AustIm
1

votes
0

answer
170

Views

How to allow pdf files in .htaccess?

I have this following codes in my htaccess file, but it doesn't allow pdf file to open, it will redirect to 404 page. how can I allow pdf files to open based on my following htaccess file. RewriteEngine on RewriteCond $1 !^(index\.php|images|public|assets|uploads|themes|updates|asset|mob|robots\.tx...
Jona
1

votes
0

answer
57

Views

serve compressed file with no file extension with .htaccess

I have a website chat plugin script that I've made a local copy of, and uploaded to our website: www.example.com/js/default. webpagetest.org reports this file is uncompressed. In .htaccess, we have: AddType x-font/woff .woff AddType x-font/ttf .ttf AddOutputFilterByType DEFLATE image/svg+xml AddOutp...
Steve
1

votes
1

answer
20

Views

Redirecting and changing URI using .htaccess

I have requests like https://example.net/files/public/file.html which I would like to redirect to https://example.com/domain/public/file.html via htaccess. In theory I would have to write an if condition and then remove the files part from the URI and then redirect to the new domain. But in practice...
Johannes
1

votes
1

answer
25

Views

.htaccess rewrite causes an endless loop

I have a .htaccess code the rediredt every user on smartphone to a competible website: RewriteEngine On RewriteEngine On RewriteCond %{QUERY_STRING} !^desktop RewriteCond %{HTTP_USER_AGENT} 'android|blackberry|googlebot-mobile|iemobile|iphone|ipod|#opera mobile|palmos|webos' [NC] RewriteRule ^ h...
1

votes
0

answer
73

Views

HTTP redirects to a page without HSTS

I am using https://hstspreload.org to test the status of HTTP to HTTPS redirect and HSTS. I receive the following error message: HTTP redirects to a page without HSTS http://example.com redirects to https://example.com/, which does not serve a HSTS header that satisfies preload conditions. Here are...
alljamin
1

votes
1

answer
37

Views

Htaccess re-write code conflict

I'm having a conflict with my htaccess file. I´m using the following code to remove the php handles: RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteRule ^ %1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*?)/?$...
Christina Rodriguez
1

votes
1

answer
87

Views

Redirect all subfolders of a language to the language folder

I'd like to redirect all subfolders of a language to the language folder. For example : http://example.com/es/folder1/ http://example.com/es/folder1/folder2/ redirect to http://example.com/es/ I tried different options such as Redirectmatch 301 ^es/(.*)$ www.example.com/es/$1 or RewriteRule ^es/(.*...
Florian
1

votes
0

answer
14

Views

Redirect my old links to new ones

I rewrite the url of my site via my .htaccess Options +FollowSymlinks -Indexes RewriteEngine On RewriteBase / RewriteRule ^([a-zA-Z]+)/$ /views/sessions/$1.php [L] RewriteRule ^blogs/([a-zA-Z]+)/$ /views/blogs/$1.php [L] RewriteRule ^groups/([a-zA-Z]+)/$ /views/groups/$1.php [L] RewriteRule ^events/...
Rocstar
1

votes
0

answer
21

Views

Issue with http authentification on wp-admin access between HTTPS and HTTP

First of all, sorry for my bad english :) I have an issue with wordpress on apache. My website is fully https. Certificate is OK. All website is restricted by http authentification. On website access (https://www.mywebsite.com/) authentification dialog display (user / password), I put my access logi...
Thibaut Simonin
1

votes
1

answer
34

Views

How can I catch all routes with apache and html

I write a js script in index.html that parse URL and redirect to a proper destination. e.g it parses example.com/#/info and shows a proper link. I want that it handle any URL such example.com/xyz. but it shows 404 error. when I add .htaccess like this: RewriteEngine on RewriteBase / RewriteCond %{...
paykoob
1

votes
0

answer
82

Views

.htaccess - redirect folder url to a file, and keep original address in address bar, whether the original url had a trailing slash or not

If a user goes to a URL formatted to look like a directory (http://www.example.com/myfolder/) I need the webserver to display a file and pass the folder name into the querystring, so it actually loads (http://www.example.com/file.php?folder=myfolder) I have got this working if a user types in (http:...
john avison
1

votes
1

answer
117

Views

htaccess - Get error the page isn't redirecting properly

I'm trying to redirect all requests except some file types to download.php with this .htaccess file. RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !(\.php|\.html|\.css|\.jpeg|\.jpg\.png|\.js)$ RewriteRule ^(.*)$ /download.php?url=$1 [L,QSA] I have place this htaccess in root folder, i...
Marios
1

votes
1

answer
231

Views

Wordpress redirect to directory with Runcloud

I have my own Wordpress website hosted on Vultr and managed with Runcloud. I created another Web application for another wordpress website. My goal is to host this second Wordpress website on https://domain/myfolder. I used to do it by adding the Wordpress install in a folder in my root folder but R...
AlphaNico
1

votes
0

answer
25

Views

Redirect to https and sub dir on apache2

I have a bolt application installed and want to do 2 things with my .htacces: 1st) Redirect to the /public/ folder, since bolt displays an error otherwise. 2nd) Change all incoming requests to https:// Seperatly I get them to work, individually I get either: 404, installation error or missing files...
Peter
1

votes
0

answer
473

Views

Moving Symfony from development to production

I have made some web sites using Symfony 4 that work using the PHP server on my local machine. When I FTP the Symfony project-directory to my 1and1 Linux web host I can not get the web sites to show up in my browser. I have tried to implement the guidelines on the Symfony documentation for doing thi...
user3425506
1

votes
1

answer
36

Views

.htaccess regex

I'm a real beginner with regex. I think I NEARLY understand this, but having spent a day and a half on it, I can't quite get it right. At the moment my OLD domain has this rewrite: RewriteRule ^/?$ 'http\:\/\/sheepdog\-training\.com\/' [R=301,L] That successfully redirects every page on the old site...
Andy
1

votes
1

answer
20

Views

Remove trailing slash and then execute successive RewriteCond statements

My website have some of the links ending with slash (/). Following are some of the example links of my site. www.website/foo/ www.website/bar Following is the .htaccess file, RewriteEngine on RewriteCond '%{DOCUMENT_ROOT}/static/%{REQUEST_URI}.html' -f RewriteRule '^(.+)' '%{DOCUMENT_ROOT}/static/...
Mallikarjun M
1

votes
0

answer
30

Views

Dynamic htaccess for www or non-www and http or https

I hope that I'll explain myself in my needs. I'm trying to write a dynamic htaccess but I don't achive to understand the conditions and the rewriting rules. Here is my thing, I built a small CMS where the user will write their base url like 'stackoverflow.com' and he'll choose with some radio input...
1

votes
0

answer
19

Views

What exactly could be the reason that my .htaccess file disturbs my script (because of redirecting)?

I am programming a php model-view-controller. Basic structure: mvc | |app | |_ models | |_ views | |_ controllers | |web |_index.php |_css |_js ... As so I use my .htaccess file for redirecting the url: RewriteEngine On RewriteBase /mvc/web/ # Let any content of web be shown (css, fonts, images,...
po0l
1

votes
1

answer
50

Views

Username in domain after slash

What is the best way to rewrite the url from https://www.example.com/user/?user=MaxMustermann to https://www.example.com/MaxMustermann I have tried that in the .htaccess-File with a RewriteRule, but if I open the URL exmaple.com/login.php, I get the Message 'User not found', whats correctly. How can...
Daniel Müller
1

votes
0

answer
25

Views

Cannot edit orders after change to https - OpenCart 2X

After changing into https and adding the following code to the .htaccess file: RewriteCond %{HTTP_HOST} domainname\.com [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.domainname.com/$1 [R,L] I get a 'SytaxError:Unexpected end of JASON input error' when I want to edit an order. Whe...
Aziz S. Kural
1

votes
0

answer
528

Views

XAMPP - Object Not Found Error

I will apologize in advance and say that I am a complete noob to PHP, XAMPP, SQL, etc. I seem to be having great trouble fixing this issue. I have installed XAMPP on a Kali Linux distribution in VMWare. I am trying to migrate my website work to this from my Windows machine. I installed XAMPP on the...
Psych_Art
1

votes
1

answer
138

Views

TYPO3 and IOS: can't open the page

My situation: I have 10 typo3-websites running on two servers: First Server (apache with php 5.6.32): typo3 versions: 6.2.3, 6.2.4 and 6.2.14 Second Server (apache with php 7.0.26): typo3 versions: 7.6.14 and 8.7.1. I'm not able to open the page on an iPhone or iPad with osx 10.x or above. I tes...
patrick
1

votes
1

answer
61

Views

Rewrite url in nginx config

I want to rewrite url https://www.beecow.info/product/whosaler-san-pham-shop-dang-590-34-390-k-p345954 to https://www.beecow.info/whosaler-san-pham-shop-dang-590-34-390-k-p345954 I want to remove apart /product/ And here is my nginx config server { listen 80; server_name beecow.info; return 30...
Nha Phuong
1

votes
1

answer
210

Views

Can I use .htaccess in a parent directory to protect a subdirectory (via .htpasswd)?

I am trying to deploy .htpasswd in a more scalable manner. I have a /parent-directory/ with several .htpasswd protected child directories: /child-directory-1/ /child-directory-2/ /child-directory-3/ /child-directory-4/ At present each child directory contains the following files: .htaccess .htpasswd...
Rounin
1

votes
0

answer
46

Views

404 not redirecting a unknown php file

I'm using LAMP Apache with CentOs 6.9 My site is abcd.xyz.com that type sub-domain also it hosted on a Virtual host. When I wrote abcd.xyz.com/hshgdgd or abcd.xyz.com/hshgdgd.ht, it redirecting 404 page fine but when I wrote extension .php like abcd.xyz.com/hshgdgd.php, it's not redirecting just t...
Ananya Sharma
1

votes
1

answer
41

Views

SEO friendly URL is not working

In my .htaccess file, a have plenty of SEO friendly links. And now I'm trying to apply SEO friendly link to a subfolder. (these files are in 'latvia' folder) Here is a content of .htaccess file: RewriteEngine on ErrorDocument 404 /404.php RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST...
Nick
1

votes
0

answer
24

Views

Redirect to parent folder on .htaccess

My Htdocs list folder sofia (Laravel 5.2) test1 (Laravel 5.2) test2 (Laravel 5.2) My URL Project is https://localhost/sofia/public/login how to edit my .htaccess when type on my url https://localhost automatic redirect to https://localhost/login or https://localhost/sofia/public/login

View additional questions