Jump to content
tsuby

htaccess Rewrite Rule problema

Recommended Posts

Posted (edited)

Inseamna ca fac altceva gresit. Asta e .htaccess-ul meu. Chestiile comentate au venit, evident, cu instalarea serverului si din ce vad eu nu prea au cum sa interfereze.

#------------------------------------------------------------------------------
# Server root folder www .htaccess
# This file provides server security limiting access to the localhost only.
# Comment next four lines to deactivate. (Allows external access)
#------------------------------------------------------------------------------

Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1

#------------------------------------------------------------------------------
# To allow execution of cgi scripts in this directory uncomment next two lines.
#------------------------------------------------------------------------------

AddHandler cgi-script .pl .cgi
Options +ExecCGI +FollowSymLinks

#------------------------------------------------------------------------------
# Activate this section to use the Private Server Feature!
# Defaults: Username - root; Password - root
# Note AuthUserFile: File path is relative to server root
# To lock server, uncomment the next 4 lines. (A name and password is required)
#------------------------------------------------------------------------------

#AuthName "Uniform Server - Server Access"
#AuthType Basic
#AuthUserFile ../../../htpasswd/www/.htpasswd
#Require valid-user


RewriteEngine On
RewriteRule ^articles/([^/]*)/$ /view.php?article_name=$1 [L]

@coolByte

Vreau exact invers. Pentru ca am ceva de genul


<a href="view.php?article_name=blabla"> </a>

Si cand dau click pe linkul ala sa devina localhost/articles/blabla.

Edited by tsuby
Posted

@tsuby - tu nici macar nu intelegi ce vrei sa faci :)

Tu trebuie sa transformi link-urile alea sub ce forma vrei tu.

Iar conditia scrisa in .htaccess nu face altceva decat sa iti interpreteze tie altfel link-urile.

Babeste spunand tu trebuie sa ai <a href="articles/bla-bla"> </a>

Posted

Ok, poate nu am expus problema foarte clar.

Eu afisez un articol la urmatoarea pagina:

http://localhost/view.php?article_name=gigi-becali-arunca-cu-banii

Si vreau, din varii motive ca linkul ala sa fie afisat utilizatorului sub urmatoarea forma:

http://localhost/articles/gigi-becali-arunca-cu-banii

Posted

Imi cer scuze, cand am citit despre link rewritingul asta, nu am citit cum trebuie si am inteles complet altceva(ceva in genul ca acei doi parametri ar fi invers).

Am rezolvat pana la urma, multumesc tuturor si scuze de n00bism.

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.



×
×
  • Create New...