0
votes

when i am trying to implement web server cofiguration using .htaccess it is not redirect me to the pointed file. I changed "AllowOverride: All" in httpd.conf and I checked mod-rewrite module was enabled. But it throws error as follows when I try the URL "localhost/student-portal/student":

  **Internal Server Error** 
  The server encountered an internal error or misconfiguration and was unable to complete 
  your request. Please contact the server administrator at [email protected] to inform them 
  of the time this error occurred, and the actions you performed just before this error. 
  More information about this error may be available in the server error log.

.htaccess file snippet

 RewriteEngine on 
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-l

 RewriteRule ^(.*)$ index.php?url=$1 [QSA, L]

index.php

<?php
    $url = $_GET['url'];
    echo '"'.$url.'"'.'is the requested page';
?>

This is my error.log file:

[Fri Dec 04 13:51:17.923527 2015] [core:alert] [pid 4796:tid 1172] [client ::1:52258] C:/Bitnami/wampstack-5.5.30-0/apache2/htdocs/student-portal/.htaccess: RewriteRule: bad flag delimiters

1
Do you have error log?Please copy the error in the log file here. - Maneesh M S
yes.. I have updated in my question section. - Nithya Neela
C:/Bitnami/wampstack-5.5.30-0/apache2/htdocs/student-portal/.htaccess: RewriteRule: bad flag delimiters This is the error. Why are you using url in condition? Is it codeigniter? I think you write teh condition in a wrong way - Maneesh M S
Thanks. I am beginner to this concept. I am trying to understand whether .htaccess works fine or not, to check that i just tried to get the value of url that will be populated during the redirection. I am simply using a plain php file - Nithya Neela
Your .htaccess working. Thats why you got that error. - Maneesh M S

1 Answers

0
votes

Flag does not allow space in it

change

RewriteRule ^(.*)$ index.php?url=$1 [QSA, L]

to

RewriteRule (.*) index.php?url=$1 [QSA,L]

^ mean start with $ mean end with

so when you use .* which mean all they are not needed