0

My .htaccess path is something such as

/home/user1/public_html/subdomain/user/transfer/.htaccess

I have a index.php on the same folder as the .htaccess

the index.php is trying to capture the query string "action" by rewrite action as the last query which something like

subdomain.mydomain.com/user/transfer/action 

where action could be cash , credit, loan or other words , to Alexander and @Trick

1 Answer 1

1

Supposing you get a request

http://subdomain.mydomain.com/user/transfer/index.php?action=register

and want to treat is internally as

http://subdomain.mydomain.com/user/transfer/transferregister

then you should place in .htaccess:

RewriteEngine On
RewriteBase /user/
RewriteCond %{REQUEST_URI} ^transfer/index\.php$
RewriteCond %{QUERY_STRING} ^action=(.*)$ [NC]
RewriteRule .* transfer/transfer%1? [R=302,L]

If you want the opposite, that is, you get a request

http://subdomain.mydomain.com/user/transfer/transferregister

and want to treat is internally as

http://subdomain.mydomain.com/user/transfer/index.php?action=register

then you should place in .htaccess:

RewriteEngine On
RewriteBase /user/
RewriteCond %{REQUEST_URI} ^transfer/transfer
RewriteRule ^transfer/transfer(.*)$ transfer/index.php?action=$1? [R=302,L]
Sign up to request clarification or add additional context in comments.

25 Comments

I tried your htaccess but it give me an error The requested URL /user/transfer/transfer1 was not found on this server.
but this is exactly what you want? Just check whether you have a directory transfer1. Or do you want the opposite? What is your input and what do you want to redirect it to?
Does it work for you now? If yes, please accept the answer :-)
Issue is resolve, got it solve at another spot, the solution was with RewriteBase /user/transfer/ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.+)$ index.php?action=$1 [QSA,L]
|

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.