help me pls

New to mod_rewrite? This is a good place to start.

help me pls

Postby antonhilman » Sun Jun 21, 2009 4:23 pm

now url:
--------------------------------------------------

#menu link, ex:
index.php?posting=kat
index.php?posting=blog
index.php?posting=contact


#list of post on menu selected, ex:
index.php?posting=blog&page=1
index.php?posting=links&page=123

#link for detail post, ex:
index.php?blog=posting&id=1234
index.php?blog=posting&id=1234



i want SEO url like this:
----------------------------------------------------------

#menu link, ex:
/posting/kat
/posting/blog
/posting/contact


#list of post on menu selected, ex:
/posting/blog/page/1
/posting/links/page/123

#link for detail post, ex:
/posting/blog/1234/title.html
/posting/dlog/1234/title.html

thx for ur help ^:)^

sending command use method GET, is it ok? need seo url too?
antonhilman
 
Posts: 13
Joined: Sat May 02, 2009 6:48 pm

Postby richardk » Mon Jun 22, 2009 7:45 am

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^posting/(blog|contact|kat)/?$      /index.php?posting=$1         [QSA,L]

RewriteRule ^posting/(blog|links)/([0-9]+)/?$   /index.php?posting=$1&page=$2 [QSA,L]

RewriteRule ^posting/blog/([0-9]+)/[^/]+\.html$ /index.php?blog=posting&id=$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

back to root

Postby antonhilman » Wed Jul 15, 2009 8:22 pm

when i try, it's back to root url (http://localhost)
antonhilman
 
Posts: 13
Joined: Sat May 02, 2009 6:48 pm

Postby richardk » Thu Jul 16, 2009 1:56 pm

when i try, it's back to root url (http://localhost)

It does run the index.php file in the document root. Are the variables are not set? (Ie. posting=kat.) What happens if you replace QSA with R?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby antonhilman » Fri Jul 24, 2009 4:55 pm

i use this .htaccess :
--------------------------start---------------------------
Options +FollowSymLinks

RewriteEngine On
RewriteBase /hilman

RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule .* - [L]

RewriteRule ^posting/(blog|contact|kat)/?$ /index.php?posting=$1 [R,L]

RewriteRule ^posting/(blog|links)/([0-9]+)/?$ /index.php?posting=$1&page=$2 [R,L]

RewriteRule ^posting/blog/([0-9]+)/[^/]+\.html$ /index.php?blog=posting&id=$1 [R,L]
---------------------------end--------------------------

my file in:
E:\AppServ\www\hilman

when i access:
http://localhost/hilman/posting/blog/571/cobajaja.html

it go to:
http://localhost/index.php?blog=posting&id=571
antonhilman
 
Posts: 13
Joined: Sat May 02, 2009 6:48 pm

Postby richardk » Sat Jul 25, 2009 2:32 pm


Are expecting /hilman/index.php? This happens because the RewriteRule is /index.php not relative (eg. index.php or ./index.php).
Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteBase /hilman/

RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule .* - [L]

RewriteRule ^posting/(blog|contact|kat)/?$ ./index.php?posting=$1 [QSA,L]
RewriteRule ^posting/(blog|links)/([0-9]+)/?$ ./index.php?posting=$1&page=$2 [QSA,L]
RewriteRule ^posting/blog/([0-9]+)/[^/]+\.html$ ./index.php?blog=posting&id=$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Help me to SEO my url

Postby antonhilman » Tue Nov 10, 2009 9:39 pm

my site:
Code: Select all
http://localhost/hilman


my URL:
Code: Select all
example.com/index.php?posting=blog            ---> list post
example.com/index.php?posting=blog$page=1    ---> list with page number
example.com/index.php?posting=blog&id=1234   ---> detail post


my SEO:
Code: Select all
example.com/posting/blog
example.com/posting/blog/1
example.com/posting/blog/1234/post-title.html


my htaccess:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteBase /hilman

RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule .* - [L]

RewriteRule ^posting/([^/]+)/?$ /index.php?posting=$1 [QSA,L]
RewriteRule ^posting/([^/]+)/([0-9]+)/?$ /index.php?posting=$1&page=$2 [QSA,L]
RewriteRule ^posting/([^/]+)/([0-9]+)/[^/]+\.html$ /index.php?posting=$1&id=$2 [QSA,L]


is't right?
antonhilman
 
Posts: 13
Joined: Sat May 02, 2009 6:48 pm


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 14 guests

cron