简体   繁体   中英

HOW can i use htaccess rewrite rules to replace address?

How can i replace address using htaccess? using rewrite rules ...

for example, i want to replace www.my-site/articles/article1/25/ to this address www.my-site/my-articles/article1/

Thank you in advance!

Try using something along the lines of this...

<IfModule mod_rewrite.c>
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /"PAGENAME"?article=$1
RewriteCond %{HTTP_HOST} ^www.my-site.com$ [NC]
RewriteRule ^(.*)$ http://my-site.com/$1 [R=301,L]
</IfModule>

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM