简体   繁体   中英

wordpress url rewriting error

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

RewriteEngine On 
RewriteRule ^([^/]*)/?$ /ams/amsproduct.php?lotno=$1 [L]

I am addding a php page to my wordpress website and i want the url rewritten in .htaccess file.

from http://example.com/ams/amsproduct.php?lotno=223
to http://example.com/223

but wordpress pages are broken when i add the htaccess above.

But all works works when i add a .html file to the code like.

RewriteRule ^([^/]*).html?$ /ams/amsproduct.php?lotno=$1 [L]

But the result looks like this http://example.com/223.html and i dont want that.

I want a result like this http://example.com/223 . Can anybody help me?

I don't know why you want to create a separate PHP page. Is there any specific reason? You should use WordPress built-in page/template functionality.

I would like to suggest you to check this link which includes all the information you need to make your own custom page/template in WordPress.

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