.htaccess

.htaccess redirect both naked http and https to www https

◇◆丶佛笑我妖孽 提交于 2020-01-05 05:31:09
问题 I have similar issue on one of my domains. I have SSL cert installed both for naked and www-domain. Now, however I want to redirect both naked http://domain.com and https://domain.com to https://www.domain.com. I have this rules in my .htaccess, but it covers redirect when you visit site explicitly with https://domain.com, but, when visiting http://domain.com, it redirects to http://www.domain.com instead https://www.domain.com. RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ RewriteCond %{HTTPS}s

mod_rewrite doesnt work if file with same name as argument exists

时间秒杀一切 提交于 2020-01-05 05:25:27
问题 I'm experiencing some issues with mod_rewrite in htaccess. Let's for instance say I request example.com/foo/, it works perfectly if I don't have a file starting with "foo.*" in the root directory. Let's say I have news.php, sitemape.xml, style.css in root, I can't use /news/ or /sitemap/ or /style/ , it will give a 404 like /news.php/ etc. Here's my rewrite string. It works locally with my Apache 2.2.22 but not at my web-host with the same Apache version. RewriteRule ^([A-Za-z0-9]+)/?$ index

Adding more directories to url using mod_rewrite

Deadly 提交于 2020-01-05 04:51:34
问题 I am using mod_write to pull urls out of my database. I have it working at a basic level, but what I am stuck on is creating complex URLs using various slugs pulled from the database as directories in the URL. Currently the url before using mod_rewrite looks like: www.domainname.co.uk/company?=1&staff=3 Which takes you to a staff profile within an appropriately styled company page. But what I want the URL to look like is: www.domainname.co.uk/COMPANY-NAME/STAFF-NAME My htaccess currently

.htaccess 403 Forbidden if url contains directory with another htaccess file

情到浓时终转凉″ 提交于 2020-01-05 04:37:11
问题 I have a .htaccess file in website root with the following rules : Options -MultiViews Options All -Indexes RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA] And another .htaccess file in a sub-directory (let's call it Foo ) : Order Allow,Deny Deny from all <files ~ "\.(js|jpe?g|png|gif|bmp|css)"> Allow from all </files> When I access for example : /test/test/test it normally redirects me to index.php , but when I my URI starts with existing

CodeIginter, Mod_Rewrite on URLs and .htaccess

此生再无相见时 提交于 2020-01-05 04:37:07
问题 I'm unsure of which stackexchange site is best suited for this question as I could see it fitting in to several, especially depending on the ultimate answer. The challenge I'm facing is that I've written a site using CodeIgniter. The site is a fairly simple company site. I've used CodeIginter to implement clean urls and the ability to expand the site in the future. There is also a simple blog and "gallery" which are both dynamic, driven by a database. In my development environment, the site

Locate and edit a WordPress .htaccess file in Google Compute Engine

淺唱寂寞╮ 提交于 2020-01-05 04:28:06
问题 I'm having trouble uploading my desired WP template (5mb), to my live site on vm instance within Google Compute Engine. I've tried every ssh command I've been able to find, in order to increase the php.ini file limits and restarted apache etc. When I access them now, they appear to be amended as desired. However, when I re-attempt the install, I get the same file limit error within WP. I've tried to sftp the files over to the WP folders using Fetch on OSX, to no avail. Permissions kept

Writing .htaccess file with php to update AJAX allow from urls

你说的曾经没有我的故事 提交于 2020-01-05 04:25:32
问题 I'm working to create some embeds for articles on a site. The embeds call a Javascript file that figures out which article to grab from my site and makes an AJAX call to the appropriate JSON file to grab the article, parse it and then display it. I also have a member system going which will allow people to sign up for an account telling me what site they will use the embeds on. What I want to do is have an .htaccess file on the root folder of these JSON files so that only approved members can

TCPDF cache problems when using https

巧了我就是萌 提交于 2020-01-05 04:22:05
问题 We have been using TCPDF to create PDFs on the fly for a while now and everything has been working fine. However, we changed to https today using the following htaccess code: RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.berau.at/$1 [R,L] Now we are getting the following TCPDF error: TCPDF ERROR: [Image] Unable to get image: /home/.sites/64/site1783/web/pdf2/cache/img_UgqqR0 If we remove the htaccess redirect for https, everything works fine again. We've searched the TCPDF

mod_rewrite - redirect to root and replace underscores with dashes

走远了吗. 提交于 2020-01-05 04:11:14
问题 I have been agonising over this for a few hours - trying to get to grips with the syntax for mnod_rewrite, Basically, I am migrating a site so that urls like: http://www.somedomain.co.uk/news/article/a_blog_post becomes http://www.somedomain.co.uk/a-blog-post The two key things here are removing the "/news/article" bit and replacing underscores with dashes. RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/?news/article$ RewriteRule ^([^_]*)_([^_]*_.*)$ $1-$2 [N] RewriteCond %

Apache Conditional RedirectMatch

北城以北 提交于 2020-01-05 04:07:31
问题 I have moved a website from /blog/ to the web root. I created a RedirectMatch 301 for my URLs which I believe is correct: RewriteEngine On RewriteBase / RedirectMatch 301 ^/blog/(.*)$ /$1 This works correctly. Now, domain.tld/blog/foo/ redirects to domain.tld/foo/ However, there is one issue. There is a page on the website with the slug: /blog/ Now you can't access the page since domain.tld/blog/ redirects to domain.tld/ So what I would like to accomplish is not to redirect /blog/, but to