Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.1k views
in Technique[技术] by (71.8m points)

apache - Remove php extension of website with htaccess

I have these links on my website:

http://crw4u.be/werkgever.php (I can only add 2 urls in my question, since i'm a n00b)

I added a code to htaccess so I can access these pages without the php:

http://crw4u.be/werkgever

It works fine with this code:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ $1.php [NC,L]

Yet I use certain forms in my php files:

<form name="planning" enctype="multipart/form-data" method="post" action="email/index.php">

And I'm getting errors when sending the form with the added code in htaccess:

Not Found. The requested URL /email/ was not found on this server.

Does anyone knows how to adapt this code? I've been searching and testing, but can't seem to solve this.

Highly appreciated!

Tomas

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Add this code also, It will let you to access directories.

RewriteCond %{REQUEST_FILENAME} !-d

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...