mod rewrite seo friendly url passed as parameter only works with prefix on url

0 votes

the following Rewrite succeeds: (site.com/content/-seo-friendly-url)

RewriteEngine on
RewriteRule ^content-(.*)$ ./get_content.php?url=$1

but this example does not work: (site.com/content/seo-friendly-url)

RewriteEngine on
RewriteRule ^(.*)$ ./get_content.php?url=$1

I get a 500 Internal Server Error

and this gets a 404 Not Found

RewriteRule ^([a-zA-Z0-9-])$ ./get_content.php?url=$1

and this passes 'get_content' as the ($1) parameter to get_content.php with no error

RewriteRule ^(.*)$ get_content.php?url=$1


my goal is to pass the url to get_content.php without a prefix.
Feb 23 in Others by Kichu
• 19,040 points
92 views

1 answer to this question.

0 votes

RewriteEngine On

RewriteRule ^content/get_content.php\?url\=seo-friendly-url$ /content/seo-friendly-url [L]

try this code or incase if that doesnt work for you try this rule 

RewriteRule ^([\w-]+)$ get_content.php?url=$1
and for more information take a look into this article https://www.generateit.net/mod-rewrite/index.php
answered Feb 24 by narikkadan
• 10,840 points

Related Questions In Others

+2 votes
2 answers

Is Reactjs SEO friendly? with google bots

Yes, with SERVER-SIDE RENDERING you will not face ...READ MORE

answered Feb 10 in Others by Shreesh
• 160 points
163 views
0 votes
1 answer

Writing SEO friendly url gets infinite loop asp.net

you should know that regex avoid cases ...READ MORE

answered Feb 11 in Others by narikkadan
• 10,840 points
148 views
0 votes
1 answer
0 votes
1 answer

PHP Convert String to SEO Friendly Url For Bengali Language Type

$string = preg_replace("/[^a-z0-9]/u", "$separator", $string);  change the ...READ MORE

answered Feb 14 in Others by narikkadan
• 10,840 points
77 views
0 votes
1 answer

Generator URL Friendly SEO PHP with .htaccess

Options +FollowSymLinks -MultiViews RewriteEngine on RewriteBase / # skip all ...READ MORE

answered Feb 14 in Others by narikkadan
• 10,840 points
639 views
0 votes
1 answer

Using .htaccsess Generator URL Friendly SEO PHP

Options +FollowSymLinks -MultiViews RewriteEngine on RewriteBase / # skip all ...READ MORE

answered Feb 27 in Others by narikkadan
• 10,840 points
60 views
0 votes
0 answers

Replacement of parameters in seo url with htaccess

My url: x.com/ara?il=istanbul&ilce=avcilar&marka=opel&model=corsa x.com/rent/istanbul-avcilar-opel-corsa In htaccess: RewriteRule ^rent/([0-9a-zA-Z-_]+)-([0-9a-zA-Z-_]+)-([0-9a-zA-Z-_]+)-([0-9a-zA-Z-_]+)$ ara.php?il=$1&ilce=$2&marka=$3&model=$4 [L,QSA] it does ...READ MORE

Mar 8 in Digital Marketing by Kichu
• 19,040 points
144 views
0 votes
0 answers

ErrorDocument 404 /404.php is not working in .htaccess file in PHP

This is the Content of my .htaccess file is: ErrorDocument ...READ MORE

Jun 21 in PHP by narikkadan
• 10,840 points
45 views
0 votes
1 answer

mod_rewrite seo friendly url passed as parameter only works with prefix on url

RewriteEngine On RewriteRule ^content/get_content.php\?url\=seo-friendly-url$ /content/seo-friendly-url [L] try this code ...READ MORE

answered Feb 27 in Others by narikkadan
• 10,840 points
29 views
0 votes
1 answer

nginx clean url with seo friendly file names

server {     listen 80;     server_name example.com;     root   /full/server/path/to/your/cms;     index  index.php;     location / ...READ MORE

answered Feb 14 in Others by narikkadan
• 10,840 points
59 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP