Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [htaccess]

Directory-level configuration file found mostly on Apache web servers

4
votes
1answer
1k 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
834 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 ....
5
votes
2answers
403 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
97 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
93 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
537 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
457 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 ...
3
votes
1answer
243 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
61 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 ...
4
votes
1answer
976 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
990 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
262 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
2k 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
880 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
1k 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
44 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
1k 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 ...
4
votes
0answers
233 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 ...
3
votes
1answer
61 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 ...
4
votes
2answers
564 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
740 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
389 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
288 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
156 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....
6
votes
1answer
2k 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 ...
-4
votes
1answer
83 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
668 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
68 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
168 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
215 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
1k 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/...
3
votes
1answer
77 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
335 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
56 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
561 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
4k 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&...
3
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
123 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
55 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....
0
votes
0answers
19 views

Redirected new domain(D1) to main domain(MD2). Domain D1 became indexed displaying exact snippet in SERPs as main MD2. How to remove D1 from index [duplicate]

Greetings Fellow Webmaster! I must apologize for the mono toned robot fashion sounding question I am only allocated 150 characters to ask my question and the question would not have made sense with ...
4
votes
2answers
2k 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
541 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
689 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
244 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'...
3
votes
1answer
220 views

How to redirect multiple new domains back to their primary domain without negatively affecting SEO/Rankings or anything else?

I've searched Google high and low. There are many answers to this question. I even asked another question similar to this one however it lacked specificity. Something this question will not lack. I ...
1
vote
1answer
897 views

Removing slash from directory URL

I need to somehow remove the last slash in my directory URLs. For example, instead of example.com/projects/, I'd like to see example.com/projects. I have been trying many solutions with no luck so far....
1
vote
0answers
31 views

How does a webmaster perform a proper redirect from one domain to another? [closed]

There are a few questions that are inherently present inside the main question. Those questions are: What is the best way to perform this type of redirect? (Presumably a 301 Perma for SEO Best ...
0
votes
1answer
2k views

How to setup htaccess to redirect both IP and www.domain.com to domain.com

I found many different htaccess examples showing how to redirect from www version to non-www version and vice versa, but I can't just find a solution to redirect IP and www-version to non-www one. ...
3
votes
1answer
2k views

How to block Googlebot from accessing one specific page

I am getting spammed by this IP: 66.249.79.70, and this website is telling me that it is from Google: https://ipinfo.io/66.249.79.70 It is filling one of my input boxes and keeps posting. I want to ...