This is my url is shown at the moment;
http://blog.example.co.uk/post?id=152&title=titleofpost
This is my htaccess as shown below;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
RewriteCond %{REQUEST_FILENAME}.php -f [NC]
RewriteRule ^ %{REQUEST_URI}.php [L]
RewriteCond %{HTTP_HOST} blog.example.com$
RewriteCond %{REQUEST_URI} !^/blog/
RewriteRule ^(.*)$ /blog/$1 [L]
How can I show the url as;
http://blog.example.co.uk/post/titleofpost
Have it like this:
Options -MultiViews
RewriteEngine On
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} \s/+post(?:\.php)?\?id=([^\s&]+)&title=([^\s&]+)\s [NC]
RewriteRule ^ /post/%1/%2? [R=302,L,NE]
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} \s/+author(?:\.php)?\?name=([^\s&]+)\s [NC]
RewriteRule ^ /author/%1? [R=302,L,NE]
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [L,R=302]
# internal forward from pretty URL to actual one
RewriteRule ^post/([\w-]+)/([\w-]+)/?$ post.php?id=$1&title=$2 [L,QSA,NC]
# internal forward from pretty URL to actual one
RewriteRule ^author/([\w-]+)/?$ author.php?name=$1 [L,QSA,NC]
# To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f [NC]
RewriteRule ^ %{REQUEST_URI}.php [L]
# Blog subdomain
RewriteCond %{HTTP_HOST} ^example\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/blog/ [NC]
RewriteRule ^(.*)$ /blog/$1 [L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.