Friendly links not working with get array - .htaccess

I got htaccess but It is not working and $_GET is empty.
I got link http://localhost:3000/?noCalc=14b4daaf66cd5e99403985bd85a4bf62
and I need http://localhost:3000/noCalc/14b4daaf66cd5e99403985bd85a4bf62
Anyone got any idea?
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options -MultiViews
Options -Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /kalkulator/services/calculate.php
RewriteRule ^noCalc/([^/]*)$ /?noCalc=$1 [QSA,L]
</IfModule>

$_GET noCalc is in index.php (/?noCalc) or in /kalkulator/services/calculate.php? I changed order of rules, please check:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options -MultiViews
Options -Indexes
RewriteEngine On
RewriteBase /
RewriteRule ^noCalc/(.*)$ /?noCalc=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /kalkulator/services/calculate.php [L]
</IfModule>

Related

Emulate DocumentRoot in htaccess

Say we cannot change DocumentRoot. (Trying to get Silex working in one.com)
Is there a way to get around this?
my setup:
root / .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ web/$1 [QSA,L]
</IfModule>
root / web / .htaccess
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
This sadly doesn't work :(

.htaccess redirect all sub directories under sub directory

I want to redirect all sub directories under sub directory root/windows/ to root/windows/ct.php
File structure of site is like
root/windows/ct.php
Redirect these type of url
http://www.site.com/windows/games/ or http://www.site.com/windows/games
http://www.site.com/windows/software/ or http://www.site.com/windows/software
To
http://www.site.com/windows/ct.php?ct=games
http://www.site.com/windows/ct.php?ct=software
I am trying like this but it redirects all url to sub directory root/windows/ct.php
RewriteRule ^([^/]*)/ /Site/windows/?ct=$1 [L]
RewriteRule ^([^/windows]*)/ /Site/windows/?ct=$1 [L] // this one shows internal server error
Complete .htaccess code
Options +FollowSymlinks
RewriteEngine on
<IfModule mod_rewrite.c>
RewriteRule ^(error) - [L]
RewriteRule ^[^/]*/[^/]*/(.*\.html) /Site/error/400/ [L]
RewriteRule ^([^/]*)/(.*\.html) /Site/software/?link=$1&id=$2 [L]
RewriteRule ^([^/]*)/ /Site/windows/?ct=$1 [L]
RewriteRule ^sitemap\.xml$ sitemap.php [L]
RewriteRule ^rss/(.*?)\.xml$ rss/$1.php [L]
</IfModule>
ErrorDocument 400 /Site/error/400/
I do not know well about .htaccess please see and suggest any possible way to do it.
Thanks.
Give this a try:
<IfModule mod_rewrite.c>
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^windows/([^/]+)/?$ /windows/ct.php?ct=$1 [L]
</IfModule>
For your localhost use this one:
<IfModule mod_rewrite.c>
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /Site/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^windows/([^/]+)/?$ windows/ct.php?ct=$1 [NC,L]
</IfModule>

.htaccess remove index.php and hide parameter name

I have the following URL
www.site.com/index.php?key=blah
I want to make it like the following using .htaccess
www.site.com/blah
How can i achieve this using .htaccess?
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+?)/?$ /index.php?key=$1 [L,QSA]
it is what i'm using on my website, it works on local too.
Options -Indexes
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?key=$1 [L]
</IfModule>

How to get an argument from the right side of the questionmark

How to redirect
/Search?Keyword=vehicles
to
/Search.php?Keyword=vehicles
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /$1.php [L,NC,QSA]

Rewriterule for index page in localhost

I tried the below code for redirect any page to index page in localhost but somehow it is not working.
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [L]
</IfModule>
Please help me to redirect to my site index page.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
IndexIgnore *
</IfModule>
Please make sure mod_rewrite module active in your httpd.conf file like:
LoadModule rewrite_module modules/mod_rewrite.so

Resources