如何使用htaccess(2文件夹)从URL中删除文件夹/文件夹名称

时间:2016-04-21 07:19:26

标签: .htaccess codeigniter url-rewriting

我正在使用localhost是否有可能?

我的目标工作是:

http://localhost/webport/portal/subportal/controlname

http://localhost/webport/controlname

的.htaccess

RewriteEngine on 
RewriteBase /MotoMate/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond $1 !^(index\.php|js|img|css|captcha|robots\.txt) 
RewriteRule ^(.*)$ /MotoMate/index.php/$1 [L] 
#AuthType Basic 
#require valid-user 
#Allow valid-user 
#Deny from all 
#Allow from env=test_uri 
#Allow from env=live_url 
#Satisfy any Options +FollowSymLinks -MultiViews 
# Turn mod_rewrite on 
RewriteEngine On 
RewriteBase / 
RewriteRule ^corporate/(.*)$ /$1 [L,NC,R] 
RewriteRule ^company/(.*)$ /$1 [L,NC,R]

1 个答案:

答案 0 :(得分:0)

试试这个:

function checkInput() {
  var v1 = document.getElementsByName("uname");
  var v2 = document.getElementsByName("pword");
  var uname = v1[0].value;
  var pword = v2[0].value;
  if (uname == "" || pword == "") {
    if (uname == "" && pword != "") {
      alert("Error: Username is Empty. Please Enter Username.");
    } else if (pword == "" && uname != "") {
      alert("Error: Password is Empty. Please Enter Password");
    } else {
      alert("Error: Username And Password is Empty. Please Enter Username and Password");
    }
    location.reload();
    return false;
  }
  return true;
}