Questions tagged [htaccess]

Directory-level configuration file found mostly on Apache web servers

Filter by
Sorted by
Tagged with
1
vote
1answer
2k views

Chrome reports a cross-origin font issue despite Access-Control-Allow-Origin header

Chrome: "Font from origin 'https://example.com' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested ...
4
votes
1answer
532 views

Redirect domain except those users coming from a specific IP address

I've got a Apache web server that serves 2 domains, now in my school one domain is blocked; one isn't (same webpage for the moment). I want that if people connect to my old domain (the one that isn't ...
2
votes
1answer
76 views

How to block my cpanel link for the users who are accessing my website.

I want to block my cpanel link i.e www.example.in/cpanel for the users who are trying to access it, but it should be accessible only for me. Is there anyway to block it. I don't know anything about it....
1
vote
1answer
41 views

If .htaccess is used to block my bot from accessing a particular directory, will I know this?

I'm working on a research project and I have a question. Say I would like to crawl all pages of a given site. In the case that my bot is blocked from accessing a certain portion of the site, I would ...
1
vote
1answer
91 views

Use .htaccess to make pretty URLs that expand abbreviation codes

Yes, I know, there are tons of questions like this, but I can't find one which solves my problem so at cost of receiving downvotes I'm going to ask this again. Even a duplicate link may help me. This ...
3
votes
2answers
491 views

Send “410 Gone” response for URLs that are a “c” or “g” followed by digits

Is there anything i can use in my htaccess to send 410 code to all the links but not some links ? Example: I would like to 410 this urls (List is about 40k links) www.example.com/c1 www.example.com/...
3
votes
1answer
2k views

How do I do a 301 redirect of specific pages with a catchall for any pages not specified?

We are changing domains and need to redirect old pages to new, and then create a catch-all to redirect any that we missed. This needs to be done as a 301 redirect using .htaccess. For example: ...
1
vote
1answer
978 views

Nginx server - Wordpress - .htaccess

I am running an Nginx server with Wordpress installed on it. The Wordpress installation has an .htaccess file in its root. Now I read that Nginx doesn't actually work with .htaccess files and using ....
4
votes
2answers
442 views

Duplicate title tags and meta descriptions after removing .html extension from files

Google Webmaster Tools/Search Console is giving me errors regarding duplicate title tags and meta descriptions. The website in question is a static HTML website. All documents do have a .html ...
1
vote
0answers
112 views

How do I create flat link URL with .htaccess [closed]

I am relatively new to URL rewriting. I recently created a forum and wishes to rewrite some of the thread URLs. I want to internally rewrite this link www.example.com/306/slug-title/6 (on client ...
2
votes
1answer
101 views

Redirect 301 from old domain to a new one affect google rank

I did the redirect from my old domain store to a new domain using 301 rules on .htaccess as simplified below: Options +FollowSymLinks RewriteEngine on RewriteCond %{THE_REQUEST} /store/catalogsearch/...
1
vote
2answers
654 views

Force ssl - 301 redirect not working

I created a 301 redirect in my cPanel to force ssl. It is not working. The last two lines were created with the cpanel for the redirect. RewriteOptions inherit # BEGIN WordPress <IfModule ...
5
votes
1answer
837 views

Execution order of different htaccess redirects

It seems that no matter what I search I just can't understand why I keep getting this issue and I for some reason can't find a good explanation on how it works. Also sorry if this quest was asked ...
2
votes
1answer
279 views

RewriteEngine On showing Apache test page

I have centos 7 and I need to put this .htaccess file inside one of my directories (www/html/forum) in order to display friendly URLs so instead of looking like example.com/index.php?user=222 it would ...
2
votes
1answer
83 views

Redirect old url with several dirs to first level

I've a lot of url with same estructure /blog/<category>/item/<slug-article> Such /blog/administracion-sistemas-unix/item/named-run-gigante I like create a rule to move a first level ...
3
votes
1answer
1k views

Transparent redirection from domain to subdomain

I have a main domain name : maindomain.com, on which I can access DNS configuration and current linked server (only files, not configuration) and a "cdn" domain (not one the same domain) cdn.domain....
4
votes
2answers
2k views

The question mark ('?') in URLs is preventing htaccess code from blocking them

I want to block someone using this dynamic URL: REQUEST_URI = /%24%24%24%26%3f%26%3f%24%24%24?cmd=get_file&arg=images/wslogo_block_page.png&sid=3257F1B3D8C5432EB676D55891B428ED164A3561 There'...
2
votes
1answer
348 views

.htaccess errordocument 404 for .htm and .html

My .htaccess is displayed below. It catches example.com/abcnonsense and sends it to my error page - 404error.htm. But fails to catch example.com/abcnonsense.htm or example.com/abcnonsense.html. In ...
3
votes
2answers
3k views

Redirecting directory without slash to directory with slash and https

I'm trying to redirect address: http://example.com/blog to address: https://example.com/blog/ Take into account that, I'm trying to redirect from NO HTTPS to HTTPS. So far, I achieved the desired ...
2
votes
1answer
1k views

Make 404 error not redirect when on different domain/subdomain

I have a PHP file on my error subdomain (https://errors.example.com). And this is meant to serve as the error page for all subdomains. The format it goes through is https://errors.example.com?type=...
2
votes
1answer
2k views

Htaccess, deny any request not coming from a form in the website

I'm not an .htaccess expert, so I beg your pardon for the basic question. In a website I'm working on there's a form. The action URL of the form is a file placed in the root of the website. I want ...
0
votes
1answer
61 views

Add content to start of all requests

In a .htaccess file or another server configuration file, is there a way to add content to the start of all requests, for example: index.html World! .htaccess or another server configuration file #...
2
votes
1answer
2k views

How to set expire date for PageSpeed Insights google in Laravel?

I create .htaccess in root project and add this code for set expire date for css and js. My server is Ubuntu 16.04 But this code not work for my website. This code in htaccess: <IfModule ...
5
votes
0answers
308 views

Ubuntu 14.04 can't enable .htaccess

I'm developing a website local and just switched from Windows to Ubuntu 16.04 - Sadly my .htaccess doesn't seems to work since rewrite rules don't apply and sources can't be found. I activated: sudo ...
2
votes
1answer
66 views

Is the redirect problem a server aliasing problem or a .htaccess problem

This past weekend, I ran into a redirect problem I have never seen before. BACKGROUND: the site is a static site that was created by the site owner in a small, remote town. She figured out HTML and ...
3
votes
2answers
756 views

Can basic HTTP password authentication interfere with CDN access?

I'm doing my best to ask this question, I'm stepping across domains here to cover for another team that is MIA on this task. Please guide me if the question sounds stupid. We are dealing with a ...
1
vote
1answer
985 views

Htaccess rewrite url for language

I need help for rewrite url via htaccess by adding language. I found this example and work fine: .htaccess language redirects with SEO-friendly URLs However I need something more generic, for avoid ...
5
votes
2answers
487 views

Properly redirect a site to WWW and HTTPS

I recently found out a problem in .htaccess file in my website. When I started the site I did a 301 redirect to redirect all non-www and http request to www with https. I added this lines of code and ...
4
votes
1answer
393 views

.htaccess to WWW And/Or HTTPS

On my site I want to do these redirects: http[s]://example.com => https://www.example.com https://www.example.com => No Redirect http://sub.example.com => https://sub.example.com http[s]://www.sub....
2
votes
1answer
176 views

.htaccess and permanent redirection with a special condition

I have a WordPress website hosted on Bluehost which contains the following URL pattern: http://www.example.com/2017/01/30/sample-post/ I wanted to permanent redirect it to use this: http://www....
5
votes
1answer
3k views

rewrite url - remove trailing / if any and add .php

I have a simple question, yet I've found no posts that answer my question. I need an htaccess file that rewrites the urls so that it removes the ending / if any, and adds .php no matter what the ...
-3
votes
1answer
91 views

display facebook.com in browser adress bar but display another site content in body

I want to display example: https://www.facebook.com in my members browser address bar but display another site content in my webpage body. I want to use .htaccess file. RewriteEngine on RewriteCond %...
1
vote
1answer
774 views

How to issue .htaccess for Laravel?

I have just launched a Laravel 5.3 project on a live server and all is going well except one. But my issue is, my websites are running on all 3 different URLs: example.com example.com/public/index....
5
votes
1answer
69 views

.htaccess several domains to point to different locations

I have a main domain in a hosting plan and then several domains "parked" in the same hosting plan: main_domain.com domain1.com domain2.com domain3.com I need each of those domains to be MASK-...
1
vote
1answer
268 views

How to set up URL masking on gh-pages and GoDaddy

I have a domain that currently redirects www.example.com to example.com. It is hosted on gh-pages. However, there is a resource link I access from index.html called privacy.html via <a href=...
3
votes
1answer
47 views

Apache redirect 301 /Path/aName/aName.html to /Path/aName.html not working

I think my web host, 1and1, is using Apache 2.4. As per title, I have a site where I have shortened the URLs to certain pages which have ended up being the sole pages in a given sub-directory, by ...
2
votes
0answers
280 views

.htaccess on IIS. Helicon Ape Manager does not convert htaccess to web config

I want to use PHP and .htaccess on my IIS server. I already know that the .htaccess is not supported by IIS. I know that the .htaccess need to convert to the web config. I want to try with Helicon App ...
5
votes
1answer
2k views

WordPress HTTP to HTTPS without trailing slash results in double redirect

I have noticed that one of my WordPress powered sites is experiencing double redirects when a user or bot attempts to visit a URL without HTTPS and a trailing slash. In short: http://example.com/...
2
votes
1answer
95 views

Would this .htaccess alone cause 404 and 500 errors?

My site is down and depending on what I change I get a 500 error or a 404 or a "Forbidden you are not authorized" error. In checking my .htaccess files I found a strange one: <IfModule !...
1
vote
1answer
437 views

How do I change my website's upload limit using .htaccess without getting a 500 Internal Server Error?

I just bought a year of web hosting and I paid for the 50GB plan. I want to allow small attachments up to 260MB each on my website. I used this: php_value upload_max_filesize php_value post_max_size ...
1
vote
1answer
59 views

Two Permanent Redirects using .htaccess

I have a Wordpress website which contains the following URL pattern: http://www.somewebsite.com/2017/01/30/sample-post/ With the help of user w3dk, I have been able to permanent redirect it to: ...
1
vote
1answer
970 views

Mod Rewrite: HTACCESS How to rewrite a single URL to another?

I have read through a ton of other similar questions and have tried too many combinations of code, but nothing works. I just need to add a single rewrite (not redirect) to my htaccess: Here is the ...
2
votes
1answer
7k views

RewriteCond to not rewrite a specific URI not working

I am working with a URL shortener (YOURLS) and I'm trying to have a certain page not directed to the link processing script. Here's the original .htaccess: # BEGIN YOURLS <IfModule mod_rewrite.c&...
2
votes
2answers
2k views

.htaccess how to redirect multiple pages to one?

I am moving hosts and the URL structure will change as the new site (same domain name) will be done the Wordpress. I have many URL's where the first part of the page name is the same and they all ...
0
votes
1answer
137 views

Moving website to new host, which .htaccess to use?

I have not done this before and am confused on a couple issues. Currently the live site is on Bluehost, created with Frontpage (yes I know), the new site is under development with Wordpress and is on ...
1
vote
1answer
59 views

.htaccess and permanent redirection issues

I have a WordPress website hosted on Bluehost which contains the following URL pattern: http://www.example.com/2017/01/30/sample-post/ I want to permanent redirect it to use this: http://www....
3
votes
2answers
3k views

htaccess problem with redirects dropping slash

I'm trying to redirect individual URLs on http://olddomain.tld (retired WordPress site) to individual URLs on https://newdomain.tld (new WordPress site) using .htaccess. Redirecting the home page ...
2
votes
1answer
680 views

mod_rewrite part of the query string

I have a situation with opencart where I need to rewrite only the "route" leaving other query strings as it is. Example: http://www.example.com/?route=module/ext/products&category_id=15&sort=...
1
vote
1answer
865 views

Link stylesheets up directories using .htaccess [duplicate]

How do I move up a directory using the <link> in HTML for my stylesheets to work while using htaccess? My directories are as: index.php .htaccess css/ styles.css php/ login.php In my ...
1
vote
1answer
270 views

.htaccess mask redirect subdirectory to another subdirectory

The URL of a page in my site is: http:/mysite.com/one/two/three/four I want to mask access this page via: http:/mysite.com/fast/quick The problem is within this page there are subfolders and, let'...