php


php htaccess url redirect based on argument [duplicate]


This question already has an answer here:
Reference: mod_rewrite, URL rewriting and “pretty links” explained
4 answers
I have a domain where the urls can be like
www.mydomain.com/home.php?q=abc
Is it possible to Let users enter url as www.mydomain.com/abc, and I somehow get the "abc" part, do all database queries, and show the contents of home.php?q=abc, but keep the url as www.mydomain.com/abc
I do know how to get /home.php?q=abc to show as /home?q=abc using htaccess.
PLease try this
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ home.php?q=$1 [QSA,L]

Related Links

Unnecessary array wrapper
how to put mysql generated values in an php array
Virtual Host doesn't work with URI in Apache 2… laravel 4.2 and laravel 5
Select All MySQL Rows
Insert data from one table to another in joined table
simple_html_dom: trying to find height in google search
JQUERY AJAX PHP MYSQLi passing multiple parameters
php Ajax and jquery form loading then submission not working
Fatal error: Class 'Stripe\Stripe_Charge' not found in
Running a ruby script from php
Remove message from GCM
How to send request to Graph Api and fetch events data?
How to explode string using capital letters as delimiter?
Get realtime photo updates of a tag from instagram
Suitable Php Framework For Shopping Cart Website
show result of date_diff in seconds

Categories

HOME
qt
clearcase
jms
code-formatting
semantic-web
google-play-services
jersey-2.0
amp
swift2
azure-data-lake
ipv6
haxe
complexity-theory
c#-7.0
renderscript
psql
akka-persistence
android-permissions
hdl
connection-refused
mime-types
amazon-sns
dragula
plyr
marquee
adapter
locks
toad
objectmapper
payeezy
cups
assertions
nanogallery
installanywhere
praat
task-parallel-library
python-jira
hdiv
access-denied
jenkins-slave
axis
webalizer
nusoap
redisson
sequence-diagram
nivo-slider
http-basic-authentication
degrees
hmmlearn
openerp-6
nrf51
nitrousio
scheduledexecutorservice
researchkit
bigdecimal
nunit-console
msbuild-4.0
flipclock
ioctl
pack
deeplink
css-paged-media
apple
wso2ml
relational-model
erlog
sunos
lifetime
symja
nesper
dmake
igor
communicate
meteor-collections
autonumber
strcmp
eclim
coalesce
ember-table
lru
node.js-stream
jquery-lazyload
ofstream
image-scanner
hardcode
differentiation
asio
drawimage
azure-acs
browser-based
mysqli-multi-query
powergui
sqlsitemapprovider
autobench
motif
regioninfo
chronic
account-management

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile