.htaccess

mod rewrite in htaccess with paging system

倾然丶 夕夏残阳落幕 提交于 2020-01-15 07:26:29
问题 I have the following code which works fine RewriteRule ^articles/([^/\.]+)/?$ articles.php?pid=$1 [L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+articles\.php\?pid=([^\s&]+) [NC] RewriteRule ^ http://www.mydomain.com/articles/%1? [R=301,L] The problem is that I have a paging systen and I send another variable to that page for my paging system which looks like this &pageNum_getArticles=1#1 I've already tried to do the following but gets confused with the hash I think RewriteRule ^articles/([^/\.

Maintenance page forwarding with htaccess does not work for proxied material

别等时光非礼了梦想. 提交于 2020-01-15 06:55:47
问题 I have scoured the internet and am at a loss as to why my maintenance page redirect and rewrite rules do not work for any proxied material or anything that is coming across through https. I am using an Apache 2.2.3 server with tomcat 6.0.24 installed on it. I have the following htaccess file: Options +FollowSymlinks RewriteCond %{REQUEST_URI} !/maintenance.html RewriteCond %{REQUEST_URI} !/images/(.*)$ RewriteCond %{REQUEST_URI} !/scripts/(.*)$ RewriteCond %{REQUEST_URI} !/styles/(.*)$

Maintenance page forwarding with htaccess does not work for proxied material

末鹿安然 提交于 2020-01-15 06:55:26
问题 I have scoured the internet and am at a loss as to why my maintenance page redirect and rewrite rules do not work for any proxied material or anything that is coming across through https. I am using an Apache 2.2.3 server with tomcat 6.0.24 installed on it. I have the following htaccess file: Options +FollowSymlinks RewriteCond %{REQUEST_URI} !/maintenance.html RewriteCond %{REQUEST_URI} !/images/(.*)$ RewriteCond %{REQUEST_URI} !/scripts/(.*)$ RewriteCond %{REQUEST_URI} !/styles/(.*)$

Strip down any parameter from URL which is not whitelisted

若如初见. 提交于 2020-01-15 06:24:47
问题 I need to strip any parameter which is not in white list e.g. URL: abc.com/somePage?phone=1234&stipAway=asd&fax=324&stripDown=disappear&zip=zip should look: abc.com/somePage?phone=1234&fax=324&zip=zip Related question: Rewrite URL using .htaccess file in case there is used parameters which is not in white list P.S. It is more complex solution needed that in first two answers mentioned. To make understandable I will illustrate with some more examples: abc.com/somePage2?stripAway=asd&fax=324

Keep HTTP or HTTPS on .htaccess

亡梦爱人 提交于 2020-01-15 05:44:08
问题 I have the following .htaccess file: RewriteEngine On RewriteCond %{REQUEST_URI} /api/profile/ RewriteRule ^(.*)$ http://whatsee-profile.s3.amazonaws.com/$1 [R,L] It redirects my fake links to the real ones and works great! But I need to keep the original HTTP or HTTPS protocol before the url. I've tried the following, but it doesn't work. RewriteEngine On RewriteCond %{REQUEST_URI} /api/profile/ RewriteRule (http|https):\/\/whatsee.plugapps.net\/api\/profile\/(.*) $1://whatsee-profile.s3

Force lowercase .htaccess

回眸只為那壹抹淺笑 提交于 2020-01-15 03:44:10
问题 I tried to do RewriteEngine On RewriteMap lc int:tolower RewriteCond %{REQUEST_URI} [A-Z] RewriteRule (.*) ${lc:$1} [R=301,L] But, I receive a 500 internal error. Not sure what's wrong. Error: /home/public_html/.htaccess: RewriteMap not allowed here [Mon Jul 18 10:33:06 2011] [alert] [client *.*.*.*] /home/public_html/.htaccess: RewriteMap not allowed here 回答1: If your using PHP you could put this in the beginning of your index.php $url = $_SERVER['REQUEST_URI']; $pattern = '/([A-Z]+)/'; if

php URL - replace question mark and parameter with slash

ⅰ亾dé卋堺 提交于 2020-01-15 03:40:58
问题 So the orginal url looked like website.com/post.php?id=130 using the following htaccess rules i was able to remove .php from the url RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php now the url looks like this website.com/post?id=130 Now i wish to replace the "?id=" with a slash to make the url look like website.com/post/130 any tips on what to do here ? 回答1: You need an additional rule for that: RewriteEngine on

Apache mod Rewrite: how to rewrite these URLs to make clean URL

一世执手 提交于 2020-01-15 03:40:28
问题 I'm trying do following rewrite from last two days. Force to use www.example.com - done Hide PHP extension - done but not sure that it's a good way 404 error to custom page - done Now my main problem is 4. Host all page on root(/) I have following files: news.php search.php store.php allstores.php Client requests like this: Type 1: http://www.example.com/news Type 2: http://www.example.com/search?q=term Type 3: http://www.example.com/allstores/H Type 4: http://www.example.com/myname I want to

Use htaccess to validate with php before granting access to a directory

纵饮孤独 提交于 2020-01-14 19:09:06
问题 I'm working on an app where users can create an account and upload images, which get stored in a directory and can then be displayed within the application itself or in a publicly visible part of the app. Now I'd really like to protect the images to ONLY allow access to these images in the event that certain conditions are met, i.e, a session is set or the permissions in the db for the image are set to public, to name a few. So, what I'd need is that whenever an image from that directory is

Document root appending in url rewriting

纵然是瞬间 提交于 2020-01-14 18:48:53
问题 I want to rewrite url from http://www.example.com/books/PHP/wrox to http://www.example.com/manuals/opensource/wrox I have added the following rule Options +FollowSymLinks RewriteEngine On RewriteRule ^books/PHP/(.*)$ manuals/opensource/$1 [R=301,L] The URL redirection appends my document root as http://www.example.com/home/projects/www/publications/devel/manuals/opensource/wrox My document root is /home/projects/www/publications/devel/ Thanks In advance for your help 回答1: It has to do with