1

I have a folder, which is inside a subdomain folder

The Folder is

/home/user1/public_html/subdomain/user/transfer

My subdomain folder is

/home/user1/public_html/subdomain/

There this folder call user in it, and transfer is inside user.

So the hierarchy is

subdomain > user > transfer

and inside transfer folder there are 2 files

index.php and also a .htaccess

My .htaccess rule is as followed:

RewriteEngine On 
RewriteRule ^transfer/(.*) /transfer/index.php-action=$1 [R=302,L]

I trying to access the page by

https://subdomain.mywebsite.com/user/transfer/cash
https://subdomain.mywebsite.com/user/transfer/credit
https://subdomain.mywebsite.com/user/transfer/AnyWord

whereby it will load the content of

https://subdomain.mywebsite.com/user/transfer/index.php?action=cash
https://subdomain.mywebsite.com/user/transfer/index.php?action=credit
https://subdomain.mywebsite.com/user/transfer/index.php?action=AnyWord

But it give me an error

Not Found

The requested URL /user/transfer/cash was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

What should I do to handle this and make my .htaccess rewrite works.

I can access

https://subdomain.mywebsite.com/user/transfer/index.php?action=cash

I just want rewrite the url to something like

https://subdomain.mywebsite.com/user/transfer/cash 

And it will load the content of

https://subdomain.mywebsite.com/user/transfer/index.php?action=cash
1
  • How about RewriteRule ^/user/transfer/(.*) /transfer/index.php-action=$1 [R=302,L] Commented Jul 23, 2014 at 15:35

2 Answers 2

1

Inside /user/transfer/.htaccess you need to have this code:

RewriteEngine On
RewriteBase /user/transfer/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?action=$1 [QSA,L]
Sign up to request clarification or add additional context in comments.

1 Comment

sorry was not able to mark earlier on, I just mark it. Thanks !!
0

Two things,

Firstly make sure your subdomain is working correctly, forget the htaccess redirect and just put a test.html file with "Hello World" in it to make sure its working correctly.

Secondly, bring your .htaccess file back up to your root directory and your rewrite rule has a typo where you have a - instead of a ? It should read.

RewriteEngine On
RewriteRule ^transfer/(.*) /user/transfer/index.php?action=$1 [L]

You also have it setup as a redirect. I've taken this part out too, so your URL is still "masked".

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.