.htaccess

.htaccess doesn't escape question mark on RewriteRule

社会主义新天地 提交于 2021-02-07 20:54:17
问题 I have a website with an old type of Single Sign On. A parent website sends users to my website with a URL like: http://test.instela.fm/index.php?gid=abcd1234&u=thedewil&id=11472 and I want to rewrite it as this: http://test.instela.fm/login/abcd1234/thedewil/11472 I have created a .htaccess file as following: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^index.php?gid=(.*)&u=(.*)&id=(.*)$ login/$1/$2/$3 [L] I tried escaping the question mark in the URL

Codeigniter htaccess not working

强颜欢笑 提交于 2021-02-07 20:34:42
问题 I am using this htaccess file on my site to remove index.php. RewriteEngine on RewriteCond $1 !^(index\.php) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] But this file doesn't work.Rewriting is enabled in Apache module.Version of codeigniter used is 2.0.1. 回答1: I've tested this without codeigniter, and it works. I create a folder under htdocs, called "demo". I put ".htaccess" there with your content + additional line

htaccess redirect only if it has value after forward slash

依然范特西╮ 提交于 2021-02-07 20:12:37
问题 I would like to apply the following htaccess rule only if there is a value after the forward slash of /events/ If I visit /events/ (Don't do anything. DO NOT apply the htaccess rule) But if I visit /events/this-can be-anything/ (Apply the htaccess rule below) RewriteRule ^events/(.*) /lp/events/index.php [L] This is obviously not working. 回答1: You need to change your regex pattern (.*) to (.+) to match at least one character after the uri. RewriteRule ^events/(.+)$ /lp/events/index.php [L] 来源

URL Rewriting - Redirect With No File Extension

情到浓时终转凉″ 提交于 2021-02-07 19:45:57
问题 I am currently using the following rules in a .htaccess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php This works well to ensure that /myfile.php works as well as just myfile (with no extension in the URL). It also handles querystrings with no problems, so myfile?var=foo also works. The problem is that these are registering in Google Analytics as being two separate files. So while myfile.php might be the third most

URL Rewriting - Redirect With No File Extension

假如想象 提交于 2021-02-07 19:45:45
问题 I am currently using the following rules in a .htaccess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php This works well to ensure that /myfile.php works as well as just myfile (with no extension in the URL). It also handles querystrings with no problems, so myfile?var=foo also works. The problem is that these are registering in Google Analytics as being two separate files. So while myfile.php might be the third most

block direct access to file but allow access through jquerys load function

倖福魔咒の 提交于 2021-02-07 13:47:00
问题 I'm using jQuery to display a certain page to a user through it's .load() function. I am doing this to allow user customization to the website, allowing them to fit it to their needs. At the moment, I am trying to display the file feed.php inside of a container within main.php ; I have come across a problem where I would like to prevent direct access to the file (i.e: going directly to the path of it ( ./feed.php )) , but still allowing it to be served through the .load() function. If I use

block direct access to file but allow access through jquerys load function

梦想与她 提交于 2021-02-07 13:46:00
问题 I'm using jQuery to display a certain page to a user through it's .load() function. I am doing this to allow user customization to the website, allowing them to fit it to their needs. At the moment, I am trying to display the file feed.php inside of a container within main.php ; I have come across a problem where I would like to prevent direct access to the file (i.e: going directly to the path of it ( ./feed.php )) , but still allowing it to be served through the .load() function. If I use

URL Rewrite on a WordPress Page Query String

非 Y 不嫁゛ 提交于 2021-02-07 09:30:00
问题 I have a WordPress site with a custom page comparison that gets a string. Now it takes: mysite.com/phones/compare/?between=samsung-galaxy-note-3-vs-nokia-lumia-730 It needs to be like that: mysite.com/phones/compare/samsung-galaxy-note-3-vs-nokia-lumia-730 I've tried adding code on my site's .htaccess that didn't worked for me and went to WordPress 404 page: RewriteRule ^phones/compare/(.+?)/?$ phones/compare/?between=$1 [NC,L] Also I need to redirect to the new search engine friendly URL too

URL Rewrite on a WordPress Page Query String

耗尽温柔 提交于 2021-02-07 09:29:01
问题 I have a WordPress site with a custom page comparison that gets a string. Now it takes: mysite.com/phones/compare/?between=samsung-galaxy-note-3-vs-nokia-lumia-730 It needs to be like that: mysite.com/phones/compare/samsung-galaxy-note-3-vs-nokia-lumia-730 I've tried adding code on my site's .htaccess that didn't worked for me and went to WordPress 404 page: RewriteRule ^phones/compare/(.+?)/?$ phones/compare/?between=$1 [NC,L] Also I need to redirect to the new search engine friendly URL too

Combining rewrites for non-www/ssl/trailing slash with upper->lowercase in .htaccess

蓝咒 提交于 2021-02-07 09:05:23
问题 So I have a straightforward rewrite to catch non-www URLs, non-SSL urls and urls missing a trailing slash to redirect to SSL, www and trailing slash using: <IfModule mod_rewrite.c> RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^(.*)$ [NC] RewriteCond %{HTTP_HOST} ^(.*[^/])$ [NC] RewriteRule (.*\/)$ https://www.tierpoint/$1 [R=301,L] RewriteRule (.*[^/])$ https://www.tierpoint/$1/ [R=301,L] </IfModule> I'd like to add a rewrite to drive uppercase