I want to change my url - php

i can change my url in simple form.
how can i use rewrite rule in htaccess
my url is http://test.com/wishdetails?wishid=czoyOiIzNiI7&title=my_weekend_story
i want this http://test.com/wishdetails/my_weekend_story
so please help me. how can i change
please do reply fast.
Thanks....................

You could achieve that using this code:
RewriteEngine On
RewriteRule ^wishdetails/my_weekend_story$ wishdetails?wishid=czoyOiIzNiI7&title=my_weekend_story
Or if my_weekend_story is variable, you could use this code:
RewriteEngine On
RewriteRule ^wishdetails/(\w+)$ wishdetails?wishid=czoyOiIzNiI7&title=$1
Please do note that you will need to have enabled mod_rewrite if you are using Apache.

RewriteEngine On
RewriteRule ^wishdetails/([^/]*)$ /wishdetails?wishid=czoyOiIzNiI7&title=$1 [L]

Related

Arrangement, Skipping and URL re=writing

I tried to re-write on my own but unable to do so, basically, I want to re-write php-based URL with .htaccess but also need to skip few parameters of php URL for example;
Original URL:
http://example.com/details.php?id=62?title=billions-s01e09-webrip-x264-fumettv
Required Format:
http://example.com/billions-s01e09-webrip-x264-fumettv-id62.html
Format Sequence:
MySiteURL/Title-of-Post-PostID.html
Looking for kind response, please guide me how can i make this possible through .htaccess.
waiting for kind response...
Good day
As you already know that you have to change the .htaccess file in your server. You can use regx to achieve your required url. Using the following code can help you.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9-]+)-id([0-9]+).html?$ details.php?id=$2&title=$1 [QSA,L]
worked fine for me. Hope will work for you too.
To rewrite
http://example.com/foobar-id123.html
to
http://example.com/details.php?id=123?title=foobar
You can use the following rule :
RewriteEngine on
RewriteRule ^([^-]+)-id([0-9]+)\.html$ /details.php?id=$2?title=$1 [NC,L]

htaccess - change URL by modifying one parameter

I have URLs that look like this:
page.php?id=1&lan=en
I want to change it to page-1.html?lan=en via htaccess.
Please note that I have to get the value of both parameters id and lan too.
Thanks in advance.
You can use codes below. I didn't try it, but it should work
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^page-(\d*).html$ page.php?id=$1 [L,QSA]

Rewrite URL using htaccess php

I want to rewrite the url in my project.
For example:
http://www.example.com/dashboard/test/ to http://dashboard.example.com/index.php
Also I want to do it for:
http://www.example.com/dashboard/test2/ to http://dashboard.example.com/index.php
Can anyone tell me the idea to rewrite the url?
First you create a .htaccess file in your root.
Than, just put the redirect commands in it.
How to compose a .htaccess and how to create rewrite rules is explained here: http://net.tutsplus.com/tutorials/other/the-ultimate-guide-to-htaccess-files/
You will need something like:
RewriteRule ^(.*)$ http://dashboard.example.com/$1 [L,QSA]
try this
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^test.*$ http://dashboard.example.com/index.php [R=301,L]

Want to rewrite url using htaccess

I am new to htaccess and want to do following thing,
I want to rewrite url like,
http://example.com/test/test.php to http://example.com/test.html
and my htaccess file present in test folder. Can anyone help to find out this problem.
Thank You
That should do it:
RewriteEngine on
RewriteRule ^(.*).html$ test/$1.php [QSA]

Apache Rewrite rule confusion

I'm trying to convert a simple url (below) in to a blog-style url, but not quite sure how to do it, all of my other rules are working fine, but I can't seem to figure this one out.
URL I want to convert: http://www.website.com/myblog.php?id=1&title=My+blog+title
URL I want it to create: http://www.website.com/1/my-blog-title
What should the rule be?
Any assistance appreciated :)
Try this
RewriteEngine on
RewriteBase /
RewriteRule ([0-9]+)/([^.]+) myblog.php?id=$1&title=$2
Try this in your .htaccess file:
RewriteEngine on
RewriteRule ^(\d+)/([^/]+)$ myblog.php?id=$1&title=$2
But here the hyphens are not replaced by plus signs.
in your .htaccess file,
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /myblog.php?id=$1 [L]
You don't (well shouldn't) need to pass the blog title to the blog file, only the ID. Hope this works

Categories