Bug trying to use RewriteRule with a .htaccess file - .htaccess

I just get into apache config and htaccess files.
I'm coding a very simple portfolio with html, css and js.
I've linked a pdf version of my CV at : .../assets/pdf/Firstname_Lastname_CV.pdf
And I would like to access it with the url .../cv
Here is my .htaccess
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^assets/pdf/Gael_Fontenelle_CV.pdf$ cv [L]
I've tried to resolve this by reading Stackoverflow and others but still ...
Thanks in advance ;)

Related

.htaccess Dynamic URL to Static URL

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]

url rewriting using .htaccess giving CSS error

I have a website with url mydomain.com/about.php?see=help
I want to rewrite it to some simple url.
I rewritten it to be mydomain.com/help.htm using the following code written at my .htaccess file which works perfectly fine.
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)\.htm$ about.php?see=$1
But I want to use mydomain.com/about/help I'm using the following code to achieve it but it gives error. The page is opening properly but it doesn't include my css file due to which a page without any css styles opens.
Options +FollowSymLinks
RewriteEngine on
RewriteRule about/(.*)/ about.php?see=$1
RewriteRule about/(.*) about.php?see=$1
Please tell me what is wrong.
Note: all files of my website including the CSS file are in same home directory of my website.

htaccess url aliases on custom website

Hello I'm developing a site with 5-6 pages like main.php(homepage), event.php(landing page of an event), article.php(another news landing page) etc etc etc...
I'm wondering how would it be possible to rewrite urls like "http://www.domain.com/event.php?eid=145" to something like "http://www.domain.com/event/title-of-event"
I've read a couple of articles on .htaccess but no luck yet currently I'm messing around with this but it's not what I want
Options +FollowSymlinks
RewriteEngine on
rewriterule ^event.php(.*)$ http://evented.localhost/event/$1 [r=301,nc]
Any help will be greatly appreciated or if you know of any decent url aliases tutorial for .htaccess.
Thnx.
EDIT:
This seems to work for event.php page it transforms a link into this http://domain.com/event/145 (according to the above example)
RewriteEngine on
#EVENT REWRITE
RewriteRule ^event/([^/\.]+)/?$ /event.php?eid=$1 [L]
RewriteRule ^event/(.*) /$1 [L]
How could I replace the event id with it's title ?
You'd have to.store the clean title with the other.data, then use the clean url to find the article.

How to write the .htaccess file to generate friendly URLs?

Talking about converting ugly URLs to friendly URLs with the .htaccess file:
Do you know how to convert this?
http://www.domainname.com.co/index.php?tpl=contenido&categoria=noticias-afic&id=35&alias=article-title
... into this?
http://www.domainname.com.co/contenido/noticias-afic/35/article-title
The URL changes dynamically.
Thanks for your answers.
Try adding the following to your .htaccess file in the root of your domain
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)$ index.php?tpl=$1&categoria=$2&id=$3&alias=$4 [L]
It should allow you to access http://www.domainname.com.co/index.php?tpl=contenido&categoria=noticias-afic&id=35&alias=article-title using http://www.domainname.com.co/contenido/noticias-afic/35/article-title

How to change the url of my website to a seo friendly one?

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]

Resources