Hiren Patel
Hiren Patel

Reputation: 41

I want to hide URL parameters of my website page by using .htaccess

http://eoflex/CAportal/readmore/?slug=blogtitle

I am trying to hide url parameters by .htaccess file is it possible to show url like this ?

Give me solution I am new to .htaccess file I am writing code in .htaccess file given below and its not working, i want url like http://eoflex/CAportal/blogtitle I don't want to display /?slug=blogtitle*

 RewriteRule ^([A-Za-z0-9-]+)/?$ page.php?slug=$1 [L]

Upvotes: 1

Views: 1332

Answers (2)

Heemanshu Bhalla
Heemanshu Bhalla

Reputation: 3763

you can use the following Code in .htaccess file . you can also use apache rewrite module . By First enabling apache rewrite module in apache server .

Write Below Lines In .htaccess file

RewriteEngine On

RewriteRule ^/CAportal/readmore/([a-zA-Z0-9_-]+)/$ /CAportal/readmore/page.php?slug=$1

HINT

^/read/This/Url/blogtitle /as/This/Url/page.php?slug=blogtitle

INFO

^ Matches the beginning of a string

$ Matches the end of a string

[0-9] Matches a number, 0–9. [2-4] would match numbers 2 to 4 inclusive.

[a-z] Matches lowercase letters a–z

[A-Z] Matches uppercase letters A–Z

[a-z0-9] Combining some of these, this matches letters a–z and numbers 0–9

Upvotes: 4

drew010
drew010

Reputation: 69957

Try this (put this in .htaccess in the document root).

RewriteRule ^CAportal/readmore/([a-zA-Z0-9_-]+)/?$ /CAPortal/readmore/?slug=$1 [L]

Upvotes: 0

Related Questions