mod-rewrite

Domain name in URL as variable

被刻印的时光 ゝ 提交于 2020-01-03 05:38:08
问题 My .htaccess file has the following code: RewriteEngine on RewriteRule ^/?(.*)$ index.php?domain=$1 [L] I'm trying to get domain names as variables from URLs like: hxxp://www.example.com/www.domain.name or hxxp://www.example.com/subdomain.domain.name or hxxp://www.example.com/domain.name but with $_GET['domain'] my variable is always 'index.php' and not the domain names. With hxxp://www.example.com/domain/www.domain.name and .htaccess code RewriteEngine on RewriteRule ^domain/?(.*)$ index.php

Removing index.php on MAMP

天涯浪子 提交于 2020-01-03 05:05:29
问题 this questions was asked before and has had many responses. The problem is nothing i tried worked. Background: i use MAMP and all of my web project are located under WebProjects which I relocated out of its standard location within the MAMP folder in Applications. so my structure is something like this: Documents/WebProjects/GreatSite/Application/... What happened so far: my understanding is that removing index.php can be done either through httpd.conf or .htaccess. anytime i touched httpd

Redirect http://www.domain.com to https://www.domain.com using .htaccess

扶醉桌前 提交于 2020-01-03 05:03:29
问题 I want to redirect my domain from http to https: http://www.domain.com --> https://www.domain.com Is it possible? I've been searching around the internet but I only found: http://domain.com --> https://www.domain.com The question is, how about peoples arriving directly on http://www.domain.com? Aren't they be served with non-https url? Same as the vice versa. I just want a simple redirection from the HTTP to HTTPS. Is it possible? Thank you 回答1: It will work for ALL versions of php and will

Redirect index.php request to http://localhost/website/ using .htaccess

半世苍凉 提交于 2020-01-03 04:59:06
问题 I'm not so familiar with configuring my .htaccess yet so please help me out. I have a link that goes to the index.php but I don't want index.php to appear in my url eg. http://localhost/website/index.php I want it to be redirected to the root folder which is http://localhost/website/ So i tried searching for answers and this is what I got so far. RewriteEngine on Options +FollowSymLinks RewriteCond %{THE_REQUEST} ^.*/index.php RewriteRule ^(.*)index.php$ http://localhost/website/$1 [R=301,L]

.htaccess hotlink protection - add image exception

南笙酒味 提交于 2020-01-03 04:52:08
问题 So this is my code: RewriteEngine on RewriteCond %{HTTP_REFERER} !^http://my-site.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://my-site.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.my-site.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.my-site.com$ [NC] RewriteRule .*\.(jpg|jpeg|gif|png|)$ http://www.my-site.com/dontsteal.png [R,NC] But I have this .htaccess file inside the images diretory. I dislike moving the dontsteal.png file from images because the file tree gets

Wordpress add rewrite rule to point to plugin file

自闭症网瘾萝莉.ら 提交于 2020-01-03 04:36:07
问题 Firstly, I have tried several different suggestions from other stackoverflow users but I haven't had any luck. I'm trying to build a kind of api from inside a plugin. The task is to let an external system call a URL within my plugin in order for it to initiate an internal procedure. Currently I have a class which has a contructor. This is inside that constructor. add_action( 'init', 'my_rewrite' ); function my_rewrite() { global $wp_rewrite; $plugin_url = plugins_url( 'my-api.php', __FILE__ )

redirection issue in www to non www with ssl/https

落爺英雄遲暮 提交于 2020-01-03 04:27:08
问题 I have a SSL certificate for non www URL: https://domain.com I know there are many similar question, but none of them seems to solve my problem. Here is what I am trying to do: Problem: 1) http://www.domain.com -> https://domain.com **www to non www DONE** 2) http://domain.com -> https://domain.com **http to https DONE** 3) https://www.domain.com -> https://domain.com/ **NOT DONE** - Getting ERROR ON Above URL number (3): Your connection is not private So far, my .htaccess file looks like so:

mod_rewrite rules for clean URLs with optional parameters

僤鯓⒐⒋嵵緔 提交于 2020-01-03 04:01:07
问题 I have the current URL: http://domain.com When you visit this URL it by default loads: http://domain.com/index.php In my .htaccess I have: Options +FollowSymLinks RewriteEngine On RewriteRule ^([^/]*)$ /index.php?var1=$1 [L] RewriteRule ^([^/]*)/([^/]*)$ /index.php?var1=$1&var2=$2 [L] RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /index.php?var1=$1&var2=$2&var3=$3 [L] RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)$ /index.php?var1=$1&var2=$2&var3=$3&var4=$4 [L] RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/

How to redirect site to https and http using htaccess for specific file and folder

喜夏-厌秋 提交于 2020-01-03 03:31:10
问题 I have a wordpress site that I wanna change https to http for only '/wp-admin' and 'wp-login.php'. I wanna use .htaccess to achieve it, but I m not good at regular expressions. Below is my current htaccess codes. # Force HTTPS for /my RewriteCond %{HTTPS} !=on RewriteCond %{THE_REQUEST} !^[A-Z]+\s/wp-admin [NC] RewriteRule !^wp-admin https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L] # Force HTTP for anything which isn't /my RewriteCond %{HTTPS} =on RewriteCond %{THE_REQUEST} ^[A-Z]+\s/wp-admin

Redirecting folder from one domain to another using .htaccess 301 redirect

别说谁变了你拦得住时间么 提交于 2020-01-03 03:26:09
问题 I'm trying to figure out a rewrite so as to redirect a directory and all of it's files & subdirectories from one domain to another. Here is what I would like to achieve: olddomain.com/oldfolder/* to http://newdomain.com/newfolder/* Currently I am using the following: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$ RewriteRule (.*) http://newdomain.com/newfolder/$1 [L,R=301] This works for www.olddomain.com but not also for olddomain.com. What's the best way to