.htaccess

retrieve subdomain as a get variable

可紊 提交于 2020-01-14 04:24:08
问题 Hi guys I'm setting up mywebapplication to give unique urls for users such as uniquename.mysite.com, anotheuniqname.mysite.com etc. I want to be able to in a php script grab the subdomain part of the url. Would be nice if I can get it as a GET variable - I think it can be done with htaccess. Any ideas? 回答1: $subdomain = substr($_SERVER['HTTP_HOST'], 0, strpos($_SERVER['HTTP_HOST'], '.')); To make sure there's a valid subdomain: $urlExplode = explode('.', $_SERVER['HTTP_HOST']); if (count(

1and1 htaccess file not working

眉间皱痕 提交于 2020-01-14 04:20:50
问题 I've created a website on my localhost and having uploaded it to my 1and1.co.uk account, I'm getting a 500 internal server error. php_flag display_errors on php_value error_reporting 9999 RewriteEngine On RewriteBase /mvc/ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] This is the contents of the htaccess file on localhost and it's causing a 500 internal server error now. Any ideas? 回答1:

redirecting url with parameters to same url without parameters

无人久伴 提交于 2020-01-14 02:58:07
问题 Using the file .htaccess, I am trying to redirect urls like this: http://www.mysite.com/a-page/?fp=123&sp=456&tp=789 to: http://www.mysite.com/a-page/ so basically redirecting url not caring about params values to the same url without any param. I have used RewriteCond/RewriteRule, Redirect and RedirectMatch but without any luck. My latest try was: RewriteCond %{QUERY_STRING} ^.+$ RewriteRule ^a-page/$ http://www.mysite.com/a-page/? [L,R=301] Any suggestion? 回答1: Well I have found a solution:

Codeigniter regexp routing

南楼画角 提交于 2020-01-14 02:02:09
问题 I have a problem with routing like this: $route['(/[a-z]{2}/)'] = 'locale/somepage'; And in .htaccess RewriteEngine on RewriteBase / RewriteRule ^(/[a-z]{2}/)$ /index.php/locale/somepage I need replace first section of url (class or controller) and call an another controller. For example, I need to url as /en/page will call controller locale , but url need not be changed. This code is not working. And if I try use only routes.php or only .htaccess, it not working too. How I can make it work?

cakephp/app/webroot/ not found when installing cakephp on Apache servor

a 夏天 提交于 2020-01-13 21:52:14
问题 What I'm trying to do: I've developed a web application with cakephp 2.2.1 on wamp. Now I want to install it on an Apache server (version 2.2.16). Error : The requested URL /inetpub/wwwroot/cakephp/app/webroot was not found on this server. What I did: That's seemed to me to be a .htaccess error. I checked that LoadModule rewrite_module libexec/apache2/mod_rewrite.so was uncommented. I made sure that Options FollowSymLinks AllowOverride All was enabled for the wwwroot/cakephp dir. Then I

cakephp/app/webroot/ not found when installing cakephp on Apache servor

爱⌒轻易说出口 提交于 2020-01-13 21:40:20
问题 What I'm trying to do: I've developed a web application with cakephp 2.2.1 on wamp. Now I want to install it on an Apache server (version 2.2.16). Error : The requested URL /inetpub/wwwroot/cakephp/app/webroot was not found on this server. What I did: That's seemed to me to be a .htaccess error. I checked that LoadModule rewrite_module libexec/apache2/mod_rewrite.so was uncommented. I made sure that Options FollowSymLinks AllowOverride All was enabled for the wwwroot/cakephp dir. Then I

.htaccess allow/deny ip using require apache 2.4

蹲街弑〆低调 提交于 2020-01-13 20:39:07
问题 My hosting provider recently updated the server to Apache 2.4 and the rules to control access to a specific folder via .htacces file doesn't work anymore with this code: Order Deny,Allow Deny from All Allow from 123.123.123.123 Allow from 123.123.123.123 Allow from 123.123.123.123 After reading Apache 2.4 documentation I understand i should use something like this instead: <RequireAny> Require ip 123.123.123.123 Require ip 123.123.123.123 Require ip 123.123.123.123 </RequireAny> but it doesn

How to setup optional parameters in mod_rewrite

社会主义新天地 提交于 2020-01-13 19:07:18
问题 I am in a new project and I'm designing the URL structure, the thing is I want URLs look like this: /category-23/keyword/5/ Where the normal page is: /search.php?q=keyword&cat=23&page=5 So my question is, cat and page fields, must be optional, I mean if I go to /keyword it should be /search.php?q=keyword (page 1) and if I go to /category/keyword should be: /search.php?q=keyword&cat=category&p=1 and also if I go to /keyword/5/ it must be: /search.php?q=keyword&p=5 Now I have my .htaccess like

How to setup optional parameters in mod_rewrite

…衆ロ難τιáo~ 提交于 2020-01-13 19:07:05
问题 I am in a new project and I'm designing the URL structure, the thing is I want URLs look like this: /category-23/keyword/5/ Where the normal page is: /search.php?q=keyword&cat=23&page=5 So my question is, cat and page fields, must be optional, I mean if I go to /keyword it should be /search.php?q=keyword (page 1) and if I go to /category/keyword should be: /search.php?q=keyword&cat=category&p=1 and also if I go to /keyword/5/ it must be: /search.php?q=keyword&p=5 Now I have my .htaccess like

How to setup optional parameters in mod_rewrite

可紊 提交于 2020-01-13 19:06:26
问题 I am in a new project and I'm designing the URL structure, the thing is I want URLs look like this: /category-23/keyword/5/ Where the normal page is: /search.php?q=keyword&cat=23&page=5 So my question is, cat and page fields, must be optional, I mean if I go to /keyword it should be /search.php?q=keyword (page 1) and if I go to /category/keyword should be: /search.php?q=keyword&cat=category&p=1 and also if I go to /keyword/5/ it must be: /search.php?q=keyword&p=5 Now I have my .htaccess like