Mike Balingit
Mike Balingit

Reputation: 13

Cleaning URL using .htaccess

From This:

crunchpaper.com/jlpt/form/try_question.php 

To This:

crunchpaper.com/jlpt/try_question/ 

I try this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^try_question$ /try_question.php/$1 [NC,QSA]

But it's not working.

I want to clean the URL above.

Please help me. Thanks

Upvotes: 0

Views: 28

Answers (2)

Mike Balingit
Mike Balingit

Reputation: 13

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^jlpt/form/try_question\.php$ jlpt/try_question/ [L]

on /var/www/crunchpaper/jlpt


<Files ~ "^\.ht">
deny from all
</Files>
Options -Indexes

# ErrorPage
ErrorDocument 400 crunchpaper.com/
ErrorDocument 403 https://crunchpaper.com/
ErrorDocument 404 https://crunchpaper.com/
ErrorDocument 405 https://crunchpaper.com/


# DefaultPage
DirectoryIndex index.php index.html

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^crunchpaper.com\.com$
RewriteRule ^(.*)$ https://crunchpaper.com/$1 [R=301,L]

on /var/www/crunchpaper

Can you tell me what is wrong

Upvotes: 0

Gabriel Hautclocq
Gabriel Hautclocq

Reputation: 3320

This rule should work :

RewriteRule ^jlpt/form/try_question\.php$ jlpt/try_question/ [L] 

Upvotes: 1

Related Questions