1

I need help with Apache .htaccess I want to redirect www.abc.com.au/folder1/folder2/file.php?pi=xyz to look like: www.abc.com.au/folder1/xyz/folder 2/

Any help will be appreciated.

1 Answer 1

1

put this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteRule ^(folder1)/([^/]+)/([^/]+)/?$ /$1/$3/file.php?pi=$2 [L,NC,QSA,NE]
Sign up to request clarification or add additional context in comments.

5 Comments

Worked good but it causing another problem. if I create another folder e.g. www.abc.com.au/folder1/xyz/ www.abc.com.au/folder1/xyz/folder 2/ wont work need to overide the root file i.e. put another file at www.abc.com.au/folder1/xyz/ (folder xyz). what to do??? any help is appriciated
I didn't understand your last comment.
it is working for the path www.abc.com.au/folder1/xyz/folder2/ good except for the path www.abc.com.au/folder1/xyz/ is not working i.e www.abc.com.au/folder1/xyz/ loading with errors. I have files at the folder www.abc.com.au/folder1/xyz/ xyz is index.php file I have links to www.abc.com.au/folder1/xyz/ . the script is working for www.abc.com.au/folder1/xyz/folder 2/ but I cannot have files in www.abc.com.au/folder1/ e.g. www.abc.com.au/folder1/index.php
All worked I just needed to change the directory name from www.abc.com.au/folder1/xyz/index.php to capital directory e.g. www.abc.com.au/folder1/XYZ/index.php
Great to know it worked. Sorry I could not respond as I was traveling today.

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.