.htaccess

Redirect for Mobile Device with .htaccess // EXCLUDE IPAD

感情迁移 提交于 2019-12-31 05:45:08
问题 I use this Code in my .htaccess to redirect mobile devices. At the moment iPad is also a mobile device. How can I change this, so that ipad is not redirected to a mobile version? Thank you! RewriteEngine on RewriteBase / # Check if this is the noredirect query string RewriteCond %{QUERY_STRING} (^|&)m=0(&|$) # Set a cookie, and skip the next rule RewriteRule ^ - [CO=mredir:0:www.website.com] # Check if this looks like a mobile device # (You could add another [OR] to the second one and add in

Disallow direct access to a file in htaccess?

别来无恙 提交于 2019-12-31 05:41:07
问题 I would like to disallow users to access directly to a PHP script on my website. This script should instead be accessed from other scripts on the website. For example, "somepage.php" can call "upload.php", but users are not allowed to type mywebsite.com/upload.php . Unfortunately I can't move my script to a specific folder. 回答1: As per the comment in my other answer it has become clear that the question actually asked something different. Since i feel that the other answer relates to the

Blocking external access to directory but allowing SSI access (or, How does the `FilesMatch` directive actually work?)

时光怂恿深爱的人放手 提交于 2019-12-31 05:40:49
问题 On an old site, where i was using PHP, I had a .htaccess in directory /noaccess as follows: # /noaccess/.htaccess <FilesMatch "^.*$"> order allow,deny deny from all </FilesMatch> And I had a PHP file like, <html> <body> <?php include('noaccess/blah.ssi'); ?> </body> </html> This works fine and the contents of blah.ssi is visible. However, on my current site I'm using SSI and the following: <html> <body> <!--#include virtual="noaccess/blah.ssi" --> </body> </html> does not work. The logs show

Make url pretty with .htaccess

怎甘沉沦 提交于 2019-12-31 05:38:52
问题 I need to adopt the following scheme: If the url contains any file/script reference, leave that without rewriting example.com/index.php ---> leave without rewriting url If the url doesn't contains any references, something similar to: example.com/some-thing-is-here Re-write this to: example.com?search.php?q=some-thing-is-here I've found the solution for (1), but they all fail with (2). I am a newbie in htaccess, so need suggestions of how to do it, or a common general method to do it. 回答1:

Mod_rewrite flat links

邮差的信 提交于 2019-12-31 05:29:06
问题 I'm trying to display my get variables as flat links. Want to change from this: http://mydomain.com/index.php?page=shop&var1=hat&var2=10 to http://mydomain.com/index.php/shop/hat/10 Please keep in mind that there isn't a fixed number of variables, that's why I use var1,var2,...etc [edit] I already have a partially working script, but works only with max 3 variables RewriteCond %{ENV:REDIRECT_STATUS} 200 RewriteRule .* - [L] RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [L] RewriteRule ^([^/\.]+

htaccess redirect old links to new domain

北慕城南 提交于 2019-12-31 05:22:31
问题 I changed my site domain, and want to redirect old urls to new domain (note: instead of numbers 93, 54 maybe any digit number exists) the old urls are: http://olddomain.com/ http://olddomain.com/45 http://olddomain.com/p/93 the new urls are: http://newdomain.com/ http://newdomain.com/45 http://newdomain.com/p/93 I tried this at htaccess: RewriteEngine on RewriteCond %{REQUEST_URI} RewriteRule http://newdomain.com/ RewriteCond %{REQUEST_URI} (\d+)/ RewriteRule (\d+)/ http://newdomain.com/$1

Creating Ajax website with links of multiple subfolders is failing

﹥>﹥吖頭↗ 提交于 2019-12-31 05:14:19
问题 I'm trying to create a site that is loading all it's content via Ajax . So let's say the site is www.abc.net . I have abc.net/index.html and this file shall always being called, whatever URL(folder/file) was typed in. So e.g. abc.net/somesubsite was called, the URL should stay as it is and just calling the index.html. The idea is now to look which URL was called and to handle that with jQuery and showing the specific div. In that way a direct link would be easily possible. Well my issue is

.htaccess RewriteRule adds drive path to URL

烂漫一生 提交于 2019-12-31 05:12:34
问题 I am using Zend Server CE (v.5.1.0) installed on C: on a Win7 machine. I have added one project to httpd.conf by adding: Alias /project "D:\Homepages\project" <Directory "D:\Homepages\project"> Options Indexes FollowSymLinks AllowOverride all Order allow,deny Allow from all </Directory> My .htaccess file in the project directory contains the following: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_URI} ^/\w*\.(css|js) [NC] RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$

How to get data by $_GET on php, when i used .htaccess

我只是一个虾纸丫 提交于 2019-12-31 05:11:10
问题 i have One problem on my small sites, the problem is on the URL. this is my URL : http://example.com/by_location_directory_list_3.aspx?page=2 And on my PHP script, i want to show a data where it gets from $_GET[page] i have do something, and something, no one works, any someone can help me? this is .HTACESS file <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^by_location_directory_list_(.*)\.aspx$ template.php?option=directory_list&location=location&id=$1 [L] Options All -Indexes <

500 Internal Server Error

大兔子大兔子 提交于 2019-12-31 04:54:06
问题 Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Why is it telling me this? .htaccess: RewriteEngine On RewriteBase /ci_series/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond