2

i need same permalink structure which is in wordpress like that :

http://example.com/wordpress/2015/08/13/sample-post/

I developed blogging in custom php

suppose any blog in year say 2015 month say 08(august) and blog name say apple

then my permalink structure like that :

http://example.com/2015/08/apple/

right now my Url is as below:

http://example.com/view-blog.php?bid=19

where bid means blog id

can anybody help me

1 Answers1

1

Use this code

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

## don't touch /forum URIs
RewriteRule ^forums/ - [L,NC]

## hide .php extension snippet

# To externally redirect /dir/foo.php?bid=123 to /dir/foo
RewriteCond %{THE_REQUEST} ^GET\s([^.]+)\.php\?bid=([^&\s]+) [NC]
RewriteRule ^ %1/%2? [R,L]

# To internally forward /dir/foo/12 to /dir/foo.php?bid=12
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/([^/]+)/?$ $1.php?bid=$2 [L,QSA]

# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^GET\s([^.]+)\.php\s [NC]
RewriteRule ^ %1 [R,L]

# To internally forward /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*?)/?$ $1.php [L]

for more details..read Here

Community
  • 1
  • 1
Leo the lion
  • 3,164
  • 2
  • 22
  • 40
  • your welcome...but do one thing..before asking on SO, try to search on google..i just used this code in my site via google then so so please..ty – Leo the lion Aug 13 '15 at 10:19
  • The answer you gave worked for me but if i want to make my url should be rewritten in this format http://blog.example.com/2015/08/travel/what-is-blog so please help me and be specific so it becomes a bit easy –  Aug 13 '15 at 10:26