I want url like www.abc.com/pagename but when I wrote RewriteRule ^(.*)$ page-detail.php?url=$1 but it will show www.abc.com/pagename not www.abc.com/index.php or www.abc.com

I want to run both pages www.abc.com/index.php and www.abc.com/pagename. How I can ?

Recommended Answers

All 2 Replies

Hi,

Never tested, but it is more likely something like this will work for you.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php 

or can be something like this.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php 


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

the above should be able to handle

www.abc.com/index.php
www.abc.com/index/

RewriteEngine on



RewriteCond $1 !^(index\.php|get_captcha\.php|info\.php|blog|pagination|video|audio|uploads|images|flowplayere|mysqladmin|admindata|theme|fonts|css|cv|csv|swf|ckeditor|ckfinder|images|uploads|js|fancybox|phpreports-master|robots\.txt|favicon\.ico)



RewriteRule ^(.*)$ /root folder here/index.php/$1 [L]


//simply use your root folder  
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.