.htaccess

.htaccess using escape quotes

扶醉桌前 提交于 2020-01-05 12:11:44
问题 I have this .htaccess: RewriteRule ^(aa.bbb|aaa,bbb|aaa-bbb|aaa_bbb||)/(.*)$ /index.html [L,NC] Will it be fine as above or should it be with espae quotes. I know in javascript is often \ in use. Like below: RewriteRule ^(aa\.bbb|aaa,bbb|aaa-bbb|aaa_bbb)/(.*)$ /index.html [L,NC] I need it for - _ , . all four of them. Do I need \ or some other sign in .htaccess and what is it. 回答1: From your rules only dot needs to be escaped (since that is special regex character) Two || should be removed

.htaccess How to redirect root URL to subdirectory files, rewrite to clean URL AND not affect subdomains?

泄露秘密 提交于 2020-01-05 11:57:19
问题 Haven't been able to find what I'm looking for in .htaccess QA's on here so forgive me if this is duplicate. I have the following problem with a static HTML site. Structure is below. My relative paths in info.html and contact.html have to use /home/css/style.css while index.html uses /css/style.css . Thanks for help. Root - .htaccess ↳ Drupal - .git ↳ Dev - .git ↳ Home - .htaccess - .git - css - js - img - info.html - contact.html - index.html Goal Dev.example.com to use all the files from

Apache folder not showing up

情到浓时终转凉″ 提交于 2020-01-05 10:24:13
问题 I'm having trouble with installing a Laravel 4 app on a hosted environment. The problem I'm having at the moment is that the "public" folder is not showing in the listing when going to www.eversite.be/laravel/, can someone tell me why that is, and how can I make it visible. Does this have something to do with Apache, for instance, a permission setting? That would be strange though since I already changed the folder to 777. Apache error log: [Mon Jan 13 17:47:11 2014] [alert] [client 178.116

How to access the domain by custom name without changing actual url in next action

让人想犯罪 __ 提交于 2020-01-05 10:18:42
问题 Here is my website www.mywebsite.com/project But i want to aceess it by the name www.mywebsite.com/project/admin and www.mywebsite.com/project/user The content is inside the project folder. How can i do this ? Here is the .htaccess i already have <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On # Redirect Trailing Slashes... RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %

url redirect to page in external site [closed]

南楼画角 提交于 2020-01-05 10:09:36
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . i have a page in my siteA http://www.siteA.com/1987/title.html i want to 301 redirect above page to a page in external site siteB as shown in example below http://www.siteB.com/page/title3.html I want to do this in htacess, not in php I have tried #redirect 301 /1987/title.html http://www.siteB.com/page/title3

rewrite URL from /index.php?page=about to /page/

你。 提交于 2020-01-05 09:36:55
问题 I'm sure this has been posted somewhere else but I can't find it. I have spent a few hours researching and trying everything I can thing of from sample code to generators. I have a site that is currently residing in a subfolder called "new". I will be moving the site to the root folder once it is ready for launch. The site is database driven and right now to access the pages you need to use a url like this: http://domain.com/new/index.php?page=about I would like to have it so the URL looks

Deny access to URI

只谈情不闲聊 提交于 2020-01-05 09:36:17
问题 I'm trying to deny access to a certain uri, namely /admin/ and have tried this .htaccess file: SetEnvIf Request_URI !^/admin/ not_admin_uri Order deny,allow Deny from all allow from 356.244.33. allow from env=not_admin_uri This works for the example IP range, but not for the "not_admin_uri" part. What's going wrong here? 回答1: To negate a match you cannot place ! in the SetEnvIf directive. You need to use negative lookahead like this: SetEnvIf Request_URI ^/(?!admin/) not_admin_uri 回答2: Maybe

.htaccess URL and directory redirect

混江龙づ霸主 提交于 2020-01-05 09:35:23
问题 This is my first post so excuse me if something it's wrong with my way of asking for help. I've been reading other posts related to my problem but none solved it. My path: http://example.com/m/page1 http://example.com/m/page2 ... And so on. I want to change the /m/pageX to /m/#pageX without hardcoding the URL and without using any additional php scripts. At the first sight, I've accomplished this task by writing the following .htaccess configuration file: Options +FollowSymlinks -MultiViews

force one page to use HTTPS and the others to use HTTP with .htaccess

妖精的绣舞 提交于 2020-01-05 09:30:50
问题 I am trying to force one page to always use https it is not working The url http://www.example.com/bookings/ and the .htaccess that I have RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^bookings$ https://www.example.com/bookings [L,R=301] 回答1: Try this rule as your very first rule in your root .htaccess : RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^bookings/?$ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L,NE,NC] 来源: https://stackoverflow.com/questions/27530010/force-one-page

RewriteCond comparing two variables in Apache htaccess

风流意气都作罢 提交于 2020-01-05 09:13:07
问题 I would like to have a rewritecond that gets true if two variables HTTP_ORIGIN and HTTP_HOST are equals. I tried RewriteCond %{HTTP:Origin} ^http://%{HTTP_HOST}(/|$) But despite Netbeans syntactic color, it appears that Apache is not replacing %{HTTP_HOST} by its value. I guessed it because RewriteCond %{HTTP:Origin} ^http://cnfr005554(/|$) RewriteCond %{HTTP_HOST} =cnfr005554 Works. So how can I test that the two variables %{HTTP:Origin} and %{HTTP_HOST} are equals? (and yes, it's for