apache - Force a prettified URL with mod_rewrite -


In this way I have made my ugly php URL beautiful:

  RewriteEngine On RewriteRule ^ main /photo([^/\.]+)/?.html$ Main / details.php? Gid = $ 2pid = $ 1  

However, now I want to emphasize on anyone

  http://www.example.com /main/details.php?gid=20&pid=5  

to redirect

  htto: //www.example.com/main/photo5 .html  

I have tried the following Rectified condom:

  Revoked code% {REQUEST_URI} ^ / Main / Description \ .php [NC] Rewrite Rule ^ Main / details.php? Gid = (. *) & Pid = (. *) Http://www.example.com/main/ Photo $ 1.html [R = 301, L]  

But that Was not working. Any ideas?

You need to decide whether the current request is original URI or not. In addition, you need to use the RewriteCond command to test the URI's query:

  rewrite %% {THE_REQUEST} ^ get / main / Details \ .php rewrite% {QUERY_STRING} ^ (([^ & amp;; * & amp;; *)) * pid = ([0-9] +) (and. *)? $ Rewrite rules ^ / Main details / .php $ / home / photo% 3 .html? [L, R = 301]  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -