Questions tagged [.htaccess]

Directory-level configuration file used by Apache web servers. Use this tag if and only if .htaccess content is directly involved in the topic. We know many people are using .htaccess, but kindly ask the members of the community to not use this tag, unless you know it is on-topic in your question.

1
vote
0answers
9 views

How to separate api and frontend requests by .htaccess

How do I have to setup my .htaccess if my project has a /frontend folder and a /backend folder and I want mydomain.com/api/* to direct to /backend and everything else to /frontend?
0
votes
0answers
8 views

Convert nginx rules to .htacees

I am trying to convert my nginx blocks to apache(.htaccess) file but not able to achive it. Can you please help me with this location = /index.php { if ($a = get) { return 301 /$a/$b; } } ...
0
votes
0answers
9 views

Target a URL path with htaccess and Rewrite to display image

Let's start by exposing the case. I have a web created in drupal that I have to modify. With an absurd amount of content, then, I need to change a URL of the src of the images by another URL and I ...
0
votes
1answer
13 views

.htaccess -> Nginx Config

Need snippet for nginx config file. Original .htaccess: Options -MultiViews RewriteEngine On # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d ...
1
vote
0answers
23 views

Too many redirects .htaccess

I have web-site. At previously host i haven't any problem with .htaccess file. Now i have some problem with TOO_MANY_REDIRECTS. I need redirect all request from yzerkalo.ru or www.yzerkalo.ru to https:...
0
votes
0answers
14 views

HTACCESS - Redirect to folder and remove from url

I'm trying to use htaccess to redirect and hide the subdirectory from URL, eg: When the borwser load www.domain.com redirect to subdirectory XYZ/ABC, but keeps in the url bar www.domain.comwithout ...
1
vote
1answer
9 views

how it's possible some redirects not works?

I have 2 types of redirect that all same and simple but number2 not work ! Redirect /post/view/231کاملترین-لیست-قیمت-اسکوتر-برقی-97 https://irscooter.com/post/category/2 Redirect /product/category?...
0
votes
0answers
13 views

Prerender htaccess for subdirectory url

This is my htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.html [L] RequestHeader set X-Prerender-Token "**************" <...
0
votes
0answers
14 views

Pass additional parameters on rewritten url

Im trying to pass multiple filters GET parameters trough the main url, however the page seems like refreshing when added and clear the inputs, or they don't work at all. How can i fix this on the ...
0
votes
0answers
10 views

How to redirect urls in correct way when subfolder is given?

I would like to redirect the old URL to the new one without loosing all parameters in htaccess file. For example: domain.com/en/subfolder/item to domain.com/en/item Is there any easy way?
0
votes
1answer
15 views

htaccess to rewrite folder, add trailing slash and remove .html

I'm trying to accomplish three things: Render html files from an s3 bucket on http://mywebsite[dotcom]/somefolder Remove the .html extension Enforce a trailing slash so that /somefolder/file.html ...
0
votes
0answers
31 views

How to symboliclink .htaccess from one directory to another

I want to make /root/work/work/src/1800myeducation.com/public_html/.htaccess use the contents of /root/work/work/src/0rcan0mic.com/public_html/.htaccess I have read about: Unionfs - I don't think ...
0
votes
0answers
12 views

Don't allow direct access to an image folder

I'm currently working on a website with a lot of images. All these images are in a folder. The images are all displayed on the website, after you logged in (The images are private). But if you type in ...
0
votes
0answers
28 views

redirecting a domain to subfolder while keeping the domain name with .htaccess

I'm new to using and changing the workings of a server and all that. So far I've only had one server with one domain for myself, but now a business is getting some traction and I want to use a ...
1
vote
1answer
32 views

how to rewrite two multiple variable using htaccess and get variable values

I have a problem in my code .. Basically i want to rewrite an URL like this news.com/category/international-news/page/1 in the above example category.php is a page and international-news is a ...
0
votes
0answers
10 views

Wordpress .htaccess redirect from .html to /product/productname 301

I am trying to redirect all the URL's within the Wordpress / Woocommerce section (over 1000+ products) to a new internal URL structure. Also this has to be a 301 redirect so Google knows it is ...
1
vote
1answer
33 views

URL rewriting removes url ending

I've been trying to rewrite a specific file I have, /u.php/example to just /u/example with htaccess. The /example part I will get and use through php url parsing. So, another question I read ...
0
votes
0answers
28 views

apache .conf file problem: Trying to remove .html from address bar

I'm running a few personal websites off a ubuntu 16.04 VPS server and I'm trying to modify each site so that no ".html" will appear as the suffix to the website and that www. will not appear as a ...
0
votes
0answers
7 views

Make it so that an auto_prepend_file in .htaccess only gets called once per visitor

I have a php_value auto_prepend_file command in .htaccess that runs a page, then redirects to the main index page. Problem is, if I just use this it will get stuck in a loop. I want a way for it to ...
0
votes
0answers
26 views

Block both the Russian Federation and Ukraine Countries from accessing my websites

I know this question has been asked before, but I want to know if there is a better more efficient way to block both the Russian Federation and Ukraine Countries from accessing my websites. These ...
1
vote
0answers
12 views

Problem of links when create friendly links with htaccess [duplicate]

When I use this code which make a friendly ULRs: RewriteRule ^(.*).html$ index.php?ps=$1 [NC,L] all work just fine. but when I try to add a "category name" to the URL like this: RewriteRule ^(.*)/(...
0
votes
0answers
16 views

Deformed CSS in Error file when invalid directory is accessed

I am showing my Error.html designed whenever an invalid file/directory is accessed while I have noticed when accessing the invalid directory the Error.html source file also changes there destination ...
0
votes
2answers
37 views

htaccess: Redirect All domains (https and http) to new domain

My current domain is a free https. I add new domains as parked domains Alias (in DirectAdmin). So for the new domain to use https, I need to disable https for the old domains. Now I want to ...
0
votes
1answer
18 views

Change a specific url to other url in wordpress using function or htaccess

Hi i have a woocommerce product and its url is http://localhost/project/product/my-product/ For this specific url i want to change the url in to http://localhost/project/my-product/ . Or some one ...
0
votes
1answer
23 views

Replace uppercase to lowercase within htaccess using regex

I have the following line in my htaccess file: RewriteRule ^images/9440/(([a-zA-Z0-9-]{2})[^/]*\.jpg)$ /images/9440/img-$2/$1 This an example of the URL that htaccess rule will apply to: /images/...
0
votes
0answers
11 views

.htaccess for specific WordPress usecase

I have a very specific configuration on my site. In the root there is a .htaccess file (1) and index.php from laravel which handles everything non wordpress. There is a folder mysite where wordpress ...
0
votes
0answers
17 views

adding .htaccess and .htpasswd files do not restrict access to localhost folder

I have followed the procedure to the letter and it does not work for me. The procedure: Create file .htaccess which has the following lines of text. AuthType Basic AuthName "restricted area" ...
-1
votes
0answers
26 views

i have migrated a CI project to a new host and domain but it dosent run properly.how can i fix it?

I had a CI project on domain1.com and I export and import DB to new MySQL,then I copy the home directory to a new host in subdomain /domain2/porti, set the database.php file and I try to run in this ...
0
votes
0answers
19 views

WordPress changes URL on admin page

We have 2 projects. https://host/ - first (on Node.js), https://host/modules/ - second (on WP). Before that nginx stays as reverse-proxy. When I'm on page 'modules', everything is good, but when I go ...
0
votes
0answers
14 views

.htaccess rewriterule is going in a infinity loop

in a domain, I have a .htaccess that is configured like this : RewriteEngine on RewriteRule ^admin$ /admin/ [R,L] RewriteRule (.*) http://www.example.com/sf2/sub/%{REQUEST_URI}?%{QUERY_STRING}&...
0
votes
0answers
13 views

Rewrite URL with .htaccess for 2 parameters with 1 as page and 2nd as $_GET value

I am using xampp for making website. 1)I want to redirect public_html/home to public_html/index.php?page=home and 2)I want to redirect public_html/about/1 to public_html/index.php?page=about&id=...
0
votes
0answers
18 views

Redirect to page produces “too many redirects” but target page is excluded in RewriteRule

Trying to redirect users to expired page after a set time but the browser gets stuck in a "too many redirects" loop. The first line is the time condition and the second line excludes the redirect ...
0
votes
1answer
24 views

Exclude specific laravel route from htaccess password protection

I protect laravel app with htaccess password protection. AuthType Basic AuthName "Password Protected Area" AuthUserFile /var/www/.htpasswd Require valid-user I want to exclude only 1 url (laravel ...
0
votes
1answer
22 views

Redirect https to http using htaccess

My website, for example, https://example.com was running on https. Now, ssl certificate validity is expired on host server. So there is requirement to redirect traffic to http://example.com. All users ...
0
votes
0answers
11 views

Apache 2.4 prompting for password although access is allowed

The directory is protected by Auth Basic, and I want to give access to a single file. Thus, my .htaccess in signage is: AuthType Basic AuthName "Signage" AuthUserFile /etc/apache2/.htpasswd <...
0
votes
0answers
8 views

Apply allow/deny access to select folders only

I currently prevent php access to my Wordpress plugin folder. However in some cases it is needed and i use this code in specific folders: order deny,allow deny from all <files ~ ".(php)$"> ...
0
votes
0answers
13 views

htaccess how to redirecting multiple domains in all variations to one domain with https

Here is my .htaccess RewriteEngine On RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !^www\.vibratape\.de$ [NC] RewriteRule ^ https://www.vibratape.de%{REQUEST_URI} [R=301,L,NE] There are ...
1
vote
1answer
20 views

Redirect permanent doesn't works

I have just updated my site from an old asp platform to a new wordpress one. The seo company that is working with Us has inserted a lot of redirects in my htaccess. like this Redirect permanent /...
-1
votes
1answer
18 views

.htaccess file to repair

I'm running Wordpress for my website. I wanted to activated Gzip compression to speed it up, so I copied pasted this code in my .htaccess file # Compress HTML, CSS, JavaScript, Text, XML and fonts ...
0
votes
1answer
19 views

Redirection to 404 page for BAD / FAKE pages not working

*Note - Site does direct to https for SSL cert Ok this is on a live site so I'll be able to give links to test. So if you access my site https://thebigmmorpglist.com and put in a random fake page ...
0
votes
1answer
13 views

Does this RewriteRule require the `^` and `$` anchors?

I've seen the following RewriteRule in multiple tutorials. RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] My question regards the matching pattern: ^(.*)$ - Match anything but make ...
0
votes
0answers
12 views

Rewrite Codes From htaccess to Nginx

I can't convert below rewrite rules from htaccess to nginx RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond $1 !^(css|js|images|inc|lang) RewriteRule ^anasayfa$ index.php [L] ...
-2
votes
0answers
10 views

I want to rewrite url in .htaccess [on hold]

I have multiple folders with multiple files inside the root folder e.g. (project/index.php), (project/foldername/filename.php). How to rewrite htaccess code for removing .php extension in the root ...
0
votes
0answers
20 views

Hide direct file access with .htaccess and allow from localhost or specific domain

please tell me how to allow access file from html(js) and deny from direct access from browsers my json file is located on the root directory (www) where some html files also present.. For Example ...
0
votes
0answers
16 views

.htaccess redirect direct server IP access

I want to redirect all direct server IP requests to another site, but leave the actual domain requests alone. For example, my server IP is 1.1.1.1 and I want all direct 1.1.1.1 requests to redirect to ...
-4
votes
0answers
26 views

Point sub domain to main domain url

I am trying to point example.com/Sumyboard/Sportstherapy/ to ono.example.com This url example.com/Sumyboard/Sportstherapy/ is a virtual url so no folder that i can point the subdomain to. So this ...
0
votes
0answers
16 views

Extract query string parameter and redirect there

Query string contains 2 parameters. I need to extract one parameter which contains a URL, then i need to redirect to that URL. Example: http://www.example.com/portal?goto=http://mypage.com&b=...
-2
votes
0answers
27 views

why is .htaccess giving 500 as an internal error for pretty URL code

Hi there I'm trying to make a blog demo and I'm having some pretty URL codes already. i have two files post.php and search.php I am having a base URL www.xyz.com and a search URL www.xyz.com/search/...
1
vote
0answers
19 views

htaccess redirect with parameters to an subfolder?

I searched for a htaccess solution to redirect from this url : https://www.example.com/my/search?areastate=sg to https://www.example.com/my/search2?state=sg I found this, but it doesn't seem to ...
0
votes
0answers
18 views

Url to download specific file using .htaccess

I have xampp based application... Content off app is on this location: /var/www/mysite.com/ I want to create link that looks like this: mysite.com/documents/3C1791F6132D4B8B5AAB235B4AE6FA67 Can I ...

http://mssss.yulina-kosm.ru