Jump to content
php.lv forumi

.htaccess - vienkāršoti linki


gaccho

Recommended Posts

Kas jaadara, lai url neparaadiitos .php paplashinaajumi?

jaaredigjee .htaccess? bet no taa es arii nesaprotu:

 

RewriteEngine on

RewriteBase localhost

RewriteRule ^galerija\.php$ galerija

 

Taa laikam nav pareizi...

Un ja es gribu vairaakaam lapaam, piem.: lapai www.kkas.lv/bildes.php un www.kkas.lv/galerija.php nonjemt tos php paplashnaajumus, tad man katra ir jaaraksta tajaa .htaccess? piem.

 

RewriteRule ^bildes\.php$ bildes

RewriteRule ^galerija\.php$ galerija

(tikai pareizaa variantaa)?

 

un vai pietiek, ka tas ir ierakstiits .htaccess failaa, jeb tas ir kkur veel jaapiemin lapas kodaa?

huh

Link to comment
Share on other sites

bubu sastādītajā php.lv/f saturā nav jāskatās?

To sauc par: clean urls

Edited by MakaTaNaw
Link to comment
Share on other sites

Izskatiiju visu cauri... nu nestraadaa:

Izmeegjinaaju:

 

RewriteEngine on

Options +FollowSymlinks

RewriteBase localhost

--------------------------------

<Files index>

ForceType application/x-httpd-php

</Files>

--------------------------------

RewriteCond %{REQUEST_galerija.php} !-f //ko noziimee shie !-f un !-d

RewriteCond %{REQUEST_galerija.php} !-d

RewriteRule ^(.*)$ galerija.php?dir=$1 [QSA,L]

--------------------------------

RewriteRule galerija+[.]php galerija$1

 

kas te ir nepareizi un kursh ir pareizais variants no shiem?

Link to comment
Share on other sites

lai enablotu .htaccess kas jaaizlabo hhtpd.conf failaa?

 

man ir:

 

AllowOverride None (kad pamainu uz All, vai AuthConfig, paraadaas 500 Internal Server Error)

 

LoadModule rewrite_module modules/mod_rewrite.so

 

AccessFileName .htaccess

Link to comment
Share on other sites

ok, taatad iztiek bez taa Add AddModule mod_rewrite.c

 

bet kaapeec tas 500 INTERNAL SERVER ERROR raadaas?

eroor logaa ir:

maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary...

 

ko dariit?

 

Vai ar sho .htaccess faila saturu pietiktu, lai nomainiitu taatad saakuma lapas url uz www.kkas.lv/sakums un taapat arii galerijas lapai... ? php kodaa nav nekas jaamaina?

"

RewriteEngine on

 

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

 

RewriteRule ^/sakums /index.php

RewriteRule ^/galerija /galerija.php"

Edited by gaccho
Link to comment
Share on other sites

The AddModule and ClearModuleList directives no longer exist. These directives were used to ensure that modules could be enabled in the correct order. The new Apache 2.0 API allows modules to explicitly specify their ordering, eliminating the need for these directives.

 

Un kaa tad ar sho?

Link to comment
Share on other sites

ok, taatad iztiek bez taa Add AddModule mod_rewrite.c

 

bet kaapeec tas 500 INTERNAL SERVER ERROR raadaas?

eroor logaa ir:

maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary...

 

ko dariit?

 

Uzmanīgi izlasi kļūdas paziņojumu "maximum number of internal redirects reached". Latviski runājot Apache ir centies pārrakstīt tavus URL, bet iegājis ciklā. Pārskati savu .htaccess failu vai tur gadījumā nevar izveidoties cikls.

Link to comment
Share on other sites

.htaccess faila saturs ir:

 

"RewriteEngine on

Options +FollowSymlinks

RewriteRule ^Sakums$ /index.php"

 

Vienkaarshi gribu, lai saakuma lapas adresee paraadiitos nevis index.php, bet Sakums... Tas vispaar ir pareizi?

 

kur te cikls var veidoties?

 

a nav gadiijumaa jaaizmanto RewriteBase? kaut gan ja ierakstu RewriteBase localhost, paraadaas, ka "RewriteBase: argument is not a valid URL, referer: http://localhost/index.php"

Link to comment
Share on other sites

×
×
  • Create New...