htaccess redirect to alias folder not working

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



htaccess redirect to alias folder not working



I have a website lets say www.myweb.com
I have a folder for my forum question named ascommunity. I have created an alias to the folder to load index.php. Which means www.myweb.com/community will index.php which will load all questions.


www.myweb.com


index.php


www.myweb.com/community


index.php



I have another php page question.php which will load the detail of the question. So If I will load www.myweb.com/community/question.php?ques=my new question, it will gve me the detail of the question. But I want url to be like www.myweb.com/community/question/mynewquestion.


www.myweb.com/community/question.php?ques=my


www.myweb.com/community/question/mynewquestion



I have written htaccess to achieve that but it's not working for alias folder. Here is what I am using in my htaccess which is in community folder.


Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %REQUEST_FILENAME !-d
RewriteCond %REQUEST_FILENAME !-f

RewriteRule ^question/([A-Za-z0-9-]+)/?$ question.php?ques=$1



When I load www.myweb.com/community/question/mynewquestion it says 404 not found error.


www.myweb.com/community/question/mynewquestion



But If I will load www.myweb.com/community/question.php?ques=mynewquestion It works fine as there is no htacces rule applied.


www.myweb.com/community/question.php?ques=mynewquestion



I got stucked here.





Your RewriteBase is wrong. It should be RewriteBase /comunity/, otherwise you will request /question-php which does not exist. Alternatively you can add the community folder to the rule target.
– arkascha
Oct 26 '16 at 13:10



RewriteBase


RewriteBase /comunity/


/question-php





I tried with that also but didn't work. I am doing like this
– gk_coder
Oct 26 '16 at 13:21






And "didn't work" means what exactly? What does it rewrite to? What does your log file say?
– arkascha
Oct 26 '16 at 13:22





I am doing like this <a href = "question/mynewquestion"> from index.php. The htaccess works fine if its like community.myweb.com/question/mynewquestion. But I want www.myweb.com/community/question/mynewquestion
– gk_coder
Oct 26 '16 at 13:27






That is not an answer to the question I asked. What is the request getting rewritten to? What does your log file say?
– arkascha
Oct 26 '16 at 13:28









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard