Jump to content
php.lv forumi

.htacccess RewriteRule


dAivEd

Recommended Posts

Labdien! Kads var palidzet ar RewriteRule ?

 

Man vajag lai no ?pg=news&news_id=40 sanaak /pg/news/news_id/40

 

Rakstu shitadi

 

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ([A-Za-z0-9\-_\.]+$) /index.php?$1=$2&$3=$4

 

Iisti nezinu, taisu pec visadiem manualiem, bet nesanak.

Link to comment
Share on other sites

RewriteRule ([A-Za-z0-9\-_\.]+$) /index.php?$1=$2&$3=$4

 

tas viss: "([A-Za-z0-9\-_\.]+$)" ir viens mainīgais $1

 

aptuveni tā:

RewriteRule kontakti/([0-9])$ /pub/index.php?page=3&sid=$1

RewriteRule (a-z)/([0-9])$ /pub/index.php?page=$1&sid=$2

Link to comment
Share on other sites

RewriteRule ([A-Za-z0-9\-_\.]+$) /index.php?$1=$2&$3=$4

 

tas viss: "([A-Za-z0-9\-_\.]+$)" ir viens mainīgais $1

 

aptuveni tā:

RewriteRule kontakti/([0-9])$ /pub/index.php?page=3&sid=$1

RewriteRule (a-z)/([0-9])$ /pub/index.php?page=$1&sid=$2

 

Mhm liels paldies ! Viss iet ! Tikai tagad reali visas bildes pazuda utt..

Cik lasiju itka to var izlabot uzrakstot:

 

RewriteBase /

 

Bet man nesanak ;( Vienalga bildes nerada jo viniem images/ut.. bet ja uzliek /images/ut.. tad viss ok, bet visas bildes mainit baiga pisshana :/

Link to comment
Share on other sites

Tak pirmīt biji uzrakstījis noteikumu, kas paredz rewrite pārtraukšanu, ja pieprasītais fails vai mape eksistē

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

Nu ja ! Tagad sanaca man shitadi

Options +FollowSymlinks

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^news/id/([^/]+)/?$ /index.php?page=news&id=$1 [L,QSA]

 

Bet vienalga bildes neraada !

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...