I have wasted a lot time fixing this issue, now i am turning to get help from experts.:
Issue:
My URLs are dynamically working such as :
https://www.example.com/services?s=10
and I want to rewrite, to serve it as following:
https://www.example.com/services/advanced-biotec-facials
I have tried following code in htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteRule services-advanced-biotec-facials$ services?s=10
but the urls is becoming:
https://www.example.com/services-advanced-biotec-facials
I have also tried following code in htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteRule services/advanced-biotec-facials$ services?s=10
the code is not working with /services/
i have copied my htaccess in following txt file for share:
https://www.nrbeauty-dubai.com/share.txt
Please help as I have wasted my time a lot already.
also, I need the old dynamic URL to be redirected to the new rewrite URL.
Thanks in advance.
have u tried swapping them
RewriteRule ^services?s=10$ http://www.example.com/services/advanced-biotec-facials/ [R=301,L]
Related
THE PROBLEM
After looking at 50+ StackOverflow posts and trying many permutations of my htaccess file, it does nothing still.
WHAT I HAVE TRIED
Using this website to generate my htaccess file: http://www.generateit.net/mod-rewrite/
Setting AllowOverride All in my httpd.conf file and restarting Apache.
MY CURRENT HTACCESS FILE
Lives in the root directory.
RewriteEngine On
RewriteBase /
RewriteRule ^find-a-local-doctor/([^/]*)/([^/]*)$ /find-a-local-doctor/?state=$1&city=$2 [L]
WHAT I WANT TO ACCOMPLISH
Change this URL:
http://www.md1network.com/find-a-local-doctor/?state=FL&city=Tampa
To this:
http://www.md1network.com/find-a-local-doctor/FL/Tampa
ADDITIONALLY
Since the actual file doing the work is: http://www.md1network.com/find-a-local-doctor/index.php, I need to be able to parse the query string with PHP. Hopefully, I will still be able to do this to get the state and city.
Please help.
Thanks.
Your existing rule looks alright but you will need an additional external redirection rule for reverse. Put this rule before your existing rule (just below RewriteBase /).
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(find-a-local-doctor)/(?:index\.php)?\?state=([^&]+)&city=([^&\s]+) [NC]
RewriteRule ^ /%1/%2/%3? [R=301,L]
I want to rewrite my site URL structure to a SEO friendly url using htaccess file.
I want to rewrite this URL:
/Site/mysite/tags.php?tag=tag
to
/Site/mysite/tags/tag
This is my script:
Options +FollowSymLinks
RewriteEngine on
RewriteRule /tag/(.*)\.php tags.php?tag=$1
other commands such as DirectoryIndex working properly but my above code not.
i know this question asked before but i can not fix this problem. excuse me please!
thanks.
Your script would rewrite /tag/foo.php to tags.php?tag=foo. What you need is
RewriteRule ^/tag/(.*) /tags.php?tag=$1
Try this code rather :
RewriteEngine on
RewriteRule ^Site/mysite/tag/(.*)$ /Site/mysite/tags.php?tag=$1
I own this website: http://www.finalyearondesk.com .
I want to change the url like :
http://www.finalyearondesk.com/index.php?idname=how-to-recover-ubuntu-after-it-is-crashed
to something like this:
finalyearondesk.com/posts/how-to-recover-ubuntu-after-it-is-crashed
using .htaccess. I don't have any knowledge of .htaccess, and I tried a lot of tutorials available online but all effort goes to vain.
So tell me how to do this.
Create a .htaccess file with this content:
RewriteEngine On
RewriteRule ^posts/([^/]*)$ /index.php?idname=$1 [L]
If it doesn't work, check that the file begins with a dot, that your hoster allows you to use .htaccess files or try to add Options +FollowSymLinks:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^posts/([^/]*)$ /index.php?idname=$1 [L]
As said in the Title,I want that http://www.example.com/contact should show http://www.example.com/contact.php. And important: without redirecting.
Unfortunately my .htaccess Code does not work:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^contact$ contact.php [L]
What could be the reason for this? Please help me out how to fix it :(!
EDIT: SOLVED. Google helped me out.
Adding Options -Multiviews was the Solution. Thanks everyone!
I do believe you have to put the / at the beginning of contact because it's part of the path.
Try this:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^/contact$ contact.php [L]
The only way to make the URL at the top show .php when going to the URL without PHP would be to redirect the browser to it. The easiest way to do that in most apache instances would be:
Redirect permanent /contact http://example.com/contact.php
my situation.....
i have this url http://www.example.com/index.php/category?catid=3
i want to have this rewritten to
http://www.example.com/bikes/3
my rewrites on the website are enabled....so i have nice urls on the website for the products
the pages i want to be rewritten are my own modules for pages with text
i have put this in my htaccess
RewriteRule .* index.php [L]
RewriteRule ^bikes/(\.*)/$ category?catid=$1
i have tried about any thing like 1000 combinations but nothing seem to work also i checked if my htaccess is working but it does.First line works also redirect to google works.
Hope someone is able to tell me what i am doing wrong here?
I had this example around here, and I think you can work it out to your needs:
Pretty URL: /topic-41/favourite-cheese.html
Ugly URL: /viewtopic.php?t=41
.htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^topic-([0-9]+)/[A-Z0-9_-]+.html$ /viewtopic.php?t=$1 [NC,L]