- This topic is empty.
-
AuthorPosts
-
August 3, 2013 at 11:53 pm #145630asiekParticipant
I pretty much want to remove .php from the end of each url in browser address bar and when linking to different pages… I found a post on css-tricks but it didn’t help :( I also used this//
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^([^\.]+)/$ $1.php
but neither worked…
To be more detailed I created a subdomain. http://example.com/test
Created a new directory within the subdomained titled “games” http://example.com/test/games
inside of that directory I created two more directories titled “findnclick” and “1” http://example.com/test/games/findnclick and http://example.com/test/games/findnclick/1
inside of the “1” directory I have multiple files labeled: index.php start.php + header.php & footer.php
When I create a link from index.php to start.php the url reads: http://example.com/test/games/findnclick/1/start.php
Which isn’t attractive at all…
What code can I place into my .htaccess file to remove the ugly extension from links and address bar url?
htaccess file
RewriteEngine on RewriteCond %{HTTP_HOST} ^test\.example\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.test\.example\.com$ RewriteRule ^/?$ "http\:\/\/example\.com\/test" [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^([^\.]+)/$ $1.php
August 4, 2013 at 12:17 pm #145654asiekParticipant@traq I’ve already tried to use “pretty URLs” but when I click the link it directs me to my main website’s home page…
August 4, 2013 at 9:42 pm #145673asiekParticipant@traq CMS as in wordpress?
No. I just uploaded the files through FTP to the subdomain directory:
/public_html/test/games/findnclick/1…
the url should originally be test.example.com
but I redirected it to example.com/testAugust 6, 2013 at 1:53 am #145787asiekParticipant@traq If I am understanding correctly…then yes I do.
Full .htaccess file//
RewriteEngine on RewriteCond %{HTTP_HOST} ^test\.example\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.test\.example\.com$ RewriteRule ^/?$ "http\:\/\/example\.com\/test" [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^([^\.]+)/$ $1.php
August 6, 2013 at 10:41 pm #145920asiekParticipantAfter adding this//
RewriteEngine on RewriteCond %{HTTP_HOST} ^test\.example\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.test\.example\.com$ RewriteRule ^/?$ "http\:\/\/example\.com\/test" [R=301,L] RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)/?$ $1.php
and changing urls to:
example.com/test/games/findnclick/1/startThe link just directs me to my main website’s coming soon page…
-
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.