htaccess使用查询字符串中断重写url

时间:2018-01-17 15:25:18

标签: php apache .htaccess mod-rewrite

所以我尝试在http://project2.local/camera?camera_id=1中重写从http://project2.local/camera/1.htaccess的网址...现在每次添加.htaccess行:

Options +FollowSymlinks

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

# Here we rewrite the camera link
# RewriteRule ^camera/([^/]*)$ /camera?camera_id=$1 [L]


# RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /camera\.php\?camera_id=([^\&\ ]+)
# RewriteRule ^/?camera\.php$ /camera/%1? [L,R=301]

# specific rule
RewriteCond %{QUERY_STRING} ^([^=]+)=([^&]+)
RewriteRule ^(camera)$ /camera.php?camera_id=$1 [L]

我收到错误Notice: Undefined index: camera_id。现在我只是尝试获取查询字符串,但它没有工作,就像从来没有?

导致此问题的原因是什么?

1 个答案:

答案 0 :(得分:2)

您可以使用此htaccess

   <div class="row" style="margin-top: 5px;margin-left: 5px;">
     <input type="radio" [value]="true" 
      (click)="selectOption($event)" ngModel="mValue" > TIMESFTO & 
        TIMESFT1
   </div>
   <div class="row" style="margin-top: 5px;margin-left: 5px;">
    <input type="radio" [value]="true" (click)="selectOption($event)" 
       ngModel="mValue" checked="checked"> RSH1
   </div>