Konz Mama
Konz Mama

Reputation: 975

Removing File URL with .htaccess

I am writing a program and run it locally with xampp. the full path to the program is http://192.168.101.103:7777/WeltesMaft/index.php

I am writing a .htaccess in C:\xampp\htdocs\WeltesMaft\ containing this

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI}  ^/([^/]+)$
RewriteRule .*  http://192.168.101.103:7777/WeltesMaft/%1 [L]

but somehow my htaccess doesnt work. it still showing like this

http://192.168.101.103:7777/WeltesMart/_resources/main.php

which is in index.php i am including main.php. So when user enters index.php, it will redirect to main.php in an instant.

I want to hide it so that the url looks like this,

http://192.168.101.103:7777/WeltesMart/

Please help me what am i doing wrong here...

Upvotes: 0

Views: 45

Answers (2)

Harsh Sanghani
Harsh Sanghani

Reputation: 1712

Change RewriteBase to your directory name and change the htaccess rule as following and try again:

RewriteEngine On
RewriteBase /WeltesMaft
RewriteCond %{REQUEST_URI}  ^/([^/]+)$
RewriteRule / index.php [L]

Upvotes: 1

Abbas
Abbas

Reputation: 412

You can use this code also.....

<IfModule mod_rewrite.c>   
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ _resources/main.php/$1 [L,QSA]
</IfModule>

Upvotes: 1

Related Questions