Pergunta

example.com/calendar/2014/4/27 <- i wan to like this from this link example.com/calendar/load.php?year=2014&month=4&date=27

i tried to do this. but its not work.. i cant fix it. that links also want like this

this link also want to work

example.com/calendar/2014

example.com/calendar/2014/4

example.com/calendar/2014/4/27

i tried to like do this.. here my htaccess code

/calendar/.htaccess

Options +FollowSymLinks
RewriteEngine On
RewriteBase /calendar/

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,NE,L]


RewriteRule ^([0-9]+)(?:/[^/]+)?/?$ load.php?year=$1 [L,QSA]

RewriteRule ^([0-9]+)/[^/]+/[^/]+/([0-9]+)/?$ load.php?year=$1&month=$2&date=$3 [L,QSA]

plzz help me to this work.. thanks

Foi útil?

Solução

Try this code in /calendar/.htaccess file:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /calendar/

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,NE,L]

RewriteRule ^([0-9]+)/?$ load.php?year=$1 [L,QSA]

RewriteRule ^([0-9]+)/([0-9]+)/?$ load.php?year=$1&month=$2 [L,QSA]

RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/?$ load.php?year=$1&month=$2&date=$3 [L,QSA]
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top