i am looking at .htaccess files and have my site now redirect all links to SEO friendly links
eg
http://example.com/index.php?page=1 to
http://example.com/home/1/
by using the following code
RewriteRule ^home/([0-9]+)/?$ index.php?page=$1 [NC,L]
but when i got to the page
http://www.example.com/home/
i get a 404 error....
How can i get it so that when /home/ is accessed it automatically redirects to /home/1/
Try with:
RewriteRule ^home/?$ http://www.yourdomain.com/home/1 [R=301,L]
RewriteRule ^home/([0-9]+)/?$ index.php?page=$1 [NC,L]
R=301 means that redirect is permanent according to HTTP status code
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.