Semantic URL htaccess Tutorial SEO Friendly Clean Links Rewrite

Adam Khoury · 180K views · 2014 · 16:57

Open on YouTube

Web developmenttutorial

Why Stack Overflow recommends it

Stack Overflow users link it when someone asks how to build clean or pretty URLs with .htaccess and needs a walkthrough of RewriteRule and regex patterns.

Recommended by 4 people across 4 different months, 2015 to 2019.

What it is

A 17-minute tutorial by Adam Khoury on using Apache .htaccess rewrite rules to turn query-string URLs into semantic, SEO-friendly clean URLs. It walks through how the rules work so viewers can write their own, however many variables the URL carries.

What people said

Recommends MGR Programming · 2015-07 · Stack Overflow · on “Bookmarking in SPA with page.js using deep links and pretty url”

@Claies: Thanks for pointing me in the right direction. I still had trouble finding a tutorial or example till I found till I found the Adam Khoury video "Semantic URL htaccess Tutorial SEO Friendly Clean Links"( [this video] )

Recommends William Romero · 2015-11 · Stack Overflow · on “How to erase multiple parameters on a URL with .htaccess?”

I found a video tutorial that can be useful to everyone who is trying to understand how to use .htaccess files. I hope it will be very helpful on your own projects. Semantic URL htaccess Tutorial SEO Friendly Clean Links [this video] Thank you to everyone who tried to help me! To the spanish speakers, you can read something about regular expresions (regex). This is the link: Reemplazar cadenas y caracteres de un string. [LINK]

Recommends Christoffer · 2018-07 · Stack Overflow · on “How to make blog based website from scratch using php and mysql?”

What you are looking for is .htaccess's RewriteRule What you want to add is: RewriteEngine On RewriteRule ^blog/(.*)$ blog.php?blog=$1 When adding this, /blog/5 will display the content of blog.php?blog=5 Also, check this video out: [this video]

Recommends MilanG · 2019-07 · Stack Overflow · on “How can I create route URL for views in core PHP?”

If I get it right, you want to use clean (SEO) links instead of calling directly php scripts. Solution depends on web server you are using. For apache (one of the most used ones) you must make redirection from your "imaginary" paths (i.e. /app/login) to your real script, which will handle the request. Again, most used solution for apache is to add your redirection rules in .htaccess file. From there apache server will read your rule for every request to your server and if conditions are met redirection will be made. There are many tutorials on how to do that, i.e. [this video] Or: [LINK]

Cites Hulio-G · 2016-01 · Stack Overflow · on “Writing clean urls with .htaccess”

Update - Alright thanks everyone for your tests, it really helped. The code is good. My problem was not having absolute "/" links. (Due to moving from public_html folder). Only 2 concerns i have now. 1.) Replace "^achilles" with "^([0-9a-zA-Z_-]+)" and thumbnails wont appear (parameter data is not being carried???) 2.) How can I make [LINK] become even shorter like [LINK] Or are the parameters absolutely mandatory. # Turn Rewrite Engine On RewriteEngine on # Set the base to /games/ so we need not include it in the rules RewriteBase /games/ #Rewrite for achilles.php?games_path=xxxxxxxxxx.yyy&category_id=zzz RewriteRule ^achilles/(.*)/([0-9]+) $1.php?games_path=$1.swf&category_id=$2 [NC,L] Whe